-
Notifications
You must be signed in to change notification settings - Fork 50
docs: support ca rotation with Omni #354
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
Draft
oguzkilcan
wants to merge
1
commit into
siderolabs:main
Choose a base branch
from
oguzkilcan:docs/ca-rotation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| --- | ||
| title: "CA Rotation" | ||
| description: "How to rotate Talos and Kubernetes API root certificate authorities." | ||
| --- | ||
|
|
||
| In general, you almost never need to rotate the root CA certificate and key for the Talos API and Kubernetes API. | ||
| Talos sets up root certificate authorities with the lifetime of 10 years, and all Talos and Kubernetes API certificates are issued by these root CAs. | ||
| So the rotation of the root CA is only needed if: | ||
|
|
||
| - You want to revoke access to the cluster for a leaked break-glass `kubeconfig` or `talosconfig`; | ||
| - You have imported a Talos cluster into Omni and want to remove the label `tainted-by-importing`; | ||
| - The root CA certificate is approaching its 10-year expiration. | ||
|
|
||
| ## Overview | ||
|
|
||
| There are some details which make Talos and Kubernetes API root CA rotation a bit different, but the general flow is the same: | ||
|
|
||
| - Generate new CA certificate and key; | ||
| - Add new CA certificate as 'accepted', so new certificates will be accepted as valid; | ||
| - Swap issuing CA to the new one, old CA as accepted; | ||
| - Refresh all certificates in the cluster; | ||
| - Remove old CA from 'accepted'. | ||
|
|
||
| At the end of the flow, old CA is completely removed from the cluster, so all certificates issued by it will be considered invalid. | ||
|
|
||
| Omni internally handles all these steps in three stages: | ||
| - **PRE-ROTATE**: Add a new CA certificate as 'accepted', | ||
| - **ROTATE**: Swap issuing CA to the new one, | ||
| - **POST-ROTATE**: Remove old CA from 'accepted'. | ||
|
|
||
| Both rotation flows are described in detail below. | ||
|
|
||
| ## Talos API CA rotation | ||
|
|
||
| Talos API CA rotation doesn't interrupt connections within the cluster, and it doesn't require a reboot of the nodes. | ||
|
|
||
| Run the following command to rotate the Talos API CA: | ||
|
|
||
| ```shell | ||
| omnictl cluster -n <cluster-name> secret rotate talos-ca | ||
| ``` | ||
|
|
||
| This command will start the rotation process and wait until the rotation is done or the timeout (can be specified with the `--wait-timeout` flag) is reached. | ||
| To return immediately without waiting for completion, use `--wait=false`. | ||
|
|
||
| <Note> | ||
| If using the [Talos API access from Kubernetes](../../kubernetes-guides/advanced-guides/talos-api-access-from-k8s) feature, pods might need to be restarted manually to pick up the new `talosconfig`. | ||
| </Note> | ||
|
|
||
| ## Kubernetes API CA rotation | ||
|
|
||
| The automated process only rotates Kubernetes API CA, used by the `kube-apiserver`, `kubelet`, etc. The rotation doesn't require a reboot of the nodes. | ||
| <Warning> | ||
| Kubernetes pods might need to be restarted to handle changes, and communication within the cluster might be disrupted during the rotation process. | ||
| </Warning> | ||
|
|
||
| Run the following command to rotate the Kubernetes API CA: | ||
|
|
||
| ```shell | ||
| omnictl cluster -n <cluster-name> secret rotate kubernetes-ca | ||
| ``` | ||
|
|
||
| This command will start the rotation process and wait until the rotation is done or the timeout (can be specified with the `--wait-timeout` flag) is reached. | ||
| To return immediately without waiting for completion, use `--wait=false`. | ||
|
|
||
| At the end of the process, Kubernetes control plane components will be restarted to pick up CA certificate changes. | ||
| Each node `kubelet` will re-join the cluster with a new client certificate. | ||
|
|
||
| Kubernetes pods might need to be restarted manually to pick up changes to the Kubernetes API CA. | ||
|
|
||
| ## CA rotation status | ||
|
|
||
| Only one rotation can be in progress at a time. Rotation status can be monitored using the Omni UI or the command: | ||
| ```shell | ||
| omnictl cluster -n <cluster-name> secret rotate status | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intentional?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Omni instance doesn't need to reach Talos nodes directly. It reaches them over SideroLink. Talos nodes need to be able to initiate the connection though.