Repository navigation
feat(talos): rotate the Kubernetes service-account signing key - #4943
Merged
Merged
Conversation
Contributor
|
Note No rendered changes. konflate 0.6.6 · rendered |
dapperdivers
force-pushed
the
feat/talos-sa-rotation
branch
from
November 21, 2026 20:18
520934b to
3f498b4
Compare
dapperdivers
force-pushed
the
feat/talos-sa-rotation
branch
from
November 21, 2026 20:25
3f498b4 to
a25350b
Compare
The old key was exposed in a session transcript. Stage A makes the apiservers trust a new key while still signing with the old one: - the key moves from v1alpha1 .cluster.serviceAccount into a Talos 1.14 KubeServiceAccountConfig document (only that has accepted.publicKeys); render.sh fills issuer.privateKey from the SOPS bundle - accepted.publicKeys lists the new key (sha256 DER 9effede6126fa48e) - the new private key is staged in service-account-next.sops.yaml Applied to talos-control-1..3 one at a time; each apiserver trusts both keys and old-key tokens still authenticate.
Sign with the new key and keep trusting the old one: - talsecret.sops.yaml certs.k8sserviceaccount.key is now the new key (set with `sops set --value-stdin`; nothing else in the bundle changed) - accepted.publicKeys lists the old key (sha256 DER ed09c41d875c9a8d) - service-account-next.sops.yaml removed (its key is in the bundle now) Applied to talos-control-1..3 one at a time; each apiserver issues new-key tokens (kid nv_t5hJvpI5c...) and still accepts old-key ones. The legacy kube-prometheus-stack-prometheus-token Secret was re-signed with the new key; Prometheus reloaded and its control-plane targets are up. Stage C (drop the old key) follows once no pod holds an old-key token.
Drop the old (exposed) key from accepted.publicKeys. The apiservers now trust only the new key (sha256 DER 9effede6126fa48e). Done after every pod's projected token carried the new key's kid (171/171, read from the kubelet dir via the Talos API, header only) and past the 1h lifetime of any controller-manager token issued before stage B. Applied to talos-control-1..3 one at a time: no 401s, no target or pod regressions.
dapperdivers
force-pushed
the
feat/talos-sa-rotation
branch
from
November 21, 2026 20:26
a25350b to
630163b
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The service-account signing key was exposed in a Claude Code session transcript on 2026-11-21. This rotates it with no downtime using Talos 1.14's
KubeServiceAccountConfig.accepted.publicKeys, the only Talos config path that lets the apiserver trust more than one key at once. Talos refuses--service-account-key-fileinextraArgs.How
patches/controller/60-service-account.yamlmoves the key from v1alpha1.cluster.serviceAccount(deleted with$patch: delete, because Talos rejects both being set) into aKubeServiceAccountConfigdocument.render.shfillsissuer.privateKeyfrom the SOPS bundle at render time, so only public keys live in git.certs.k8sserviceaccount.keyintalsecret.sops.yamlswapped viasops set --value-stdin; the rest of the bundle was checked byte-identical after decryption. Applied one control plane at a time.observability/kube-prometheus-stack-prometheus-tokenSecret (used by the chart's control-plane ServiceMonitors) was re-signed with the new key.Verified (both stages already applied live)
service-account.pubholds both keys (fingerprintsed09c41d…old,9effede6…new).kid, and old-key tokens are still accepted (Prometheus targets stayed up).task talos:diff-cluster: all 11 nodes reportNo changes., so this PR matches what is running..private/backups/and in Infisical/Infrastructure/Talos/Backups.accepted. Applied at 20:08 UTC, after all 171 pods with tokens carried the new key'skid(checked by reading the token header from each kubelet directory through the Talos API) and after the 1-hour lifetime of any controller-manager token issued before stage B had passed. Each apiserver now trusts only9effede6…. No 401s, no target, pod or Flux regressions.All three stages are live;
task talos:diff-clusterreportsNo changes.on 11/11 nodes. The exposed key no longer authenticates.