Skip to content

Use bootstrap tokens provisioned by ansible for K3s instead of persistent tokens in cloud-init metadata #589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Feb 27, 2025

Conversation

wtripp180901
Copy link
Contributor

@wtripp180901 wtripp180901 commented Feb 19, 2025

Server now generates a short lived bootstrap token which nodes use for initial connection/auth. Performed in site.yml rather than ansible-init. Tokens no longer needs to be generated by ansible, but consistent node passwords are needed (previously we were using the ansible-generated token for this) so added to the secret store.

NB: When upgrading previous clusters, the groupsk3s_server and k3s_agent must now be defined - see environments/common/layouts/everything.

NB: Given k3s is not currently required, it could be disabled for production clusters (even when using a stackhpc image) by removing any hosts from the k3s_server and k3s_agent groups.

@wtripp180901 wtripp180901 requested a review from a team as a code owner February 19, 2025 09:36
@wtripp180901
Copy link
Contributor Author

@sd109
Copy link
Member

sd109 commented Feb 19, 2025

@wtripp180901 Do we also need to update this table in the compute-init README as a result of this change?

Do we have a plan yet for how to get nodes to rejoin the k3s cluster after a compute-init driven rebuild? Is it even possible with this bootstrap token approach?

@sjpb
Copy link
Collaborator

sjpb commented Feb 19, 2025

@sd109

Do we have a plan yet for how to get nodes to rejoin the k3s cluster after a compute-init driven rebuild? Is it even possible with this bootstrap token approach?

Yeah I think so, we discussed it the other day. The RebootProgram will have to generate a new token, that will be distributed by 🪄 (i.e. however we distribute other secrets), then the node picks it up on boot.

A failure to provision a new token which results in RebootProgram failing and node being marked down (unless we do something to handle that) so I think that will work.

@sjpb sjpb changed the title K3s now uses bootstrap tokens instead of cloud-init metadata Use bootstrap tokens provisioned by ansible for K3s instead of persistent tokens in cloud-init metadata Feb 19, 2025
@wtripp180901
Copy link
Contributor Author

@wtripp180901 wtripp180901 requested a review from sjpb February 21, 2025 10:25
@stackhpc stackhpc deleted a comment from sjpb Feb 25, 2025
@wtripp180901 wtripp180901 requested a review from sjpb February 25, 2025 14:48
Copy link
Collaborator

@sjpb sjpb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still want to change token definition.

@wtripp180901 wtripp180901 requested a review from sjpb February 26, 2025 13:56
Copy link
Collaborator

@sjpb sjpb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiiny comments, one on security

@wtripp180901 wtripp180901 requested a review from sjpb February 27, 2025 14:58
Copy link
Collaborator

@sjpb sjpb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sjpb sjpb merged commit ac3a31c into main Feb 27, 2025
7 checks passed
@sjpb sjpb deleted the feat/k3s-bootstrap branch February 27, 2025 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants