Make a Talos secrets bundle
Generate a cluster's Talos secrets bundle with its imported service-account key, store it in 1Password, and pin its new Kubernetes CA in the cutover pull request.
Use this runbook during Rebuild a cluster on Talos. The secrets bundle holds every key and CA of a Talos cluster. talosctl gen secrets makes a new, self-signed Kubernetes CA. The bundle imports only the service-account signing key, so the issuer and its JWKS do not change. The OpenTofu root in clusters/<site>/talos/ reads the bundle from 1Password.
The owner runs this runbook, because it reads the signing key out of the cluster's current bundle, the Secure Note talos-<site>-secrets.
warning
This procedure changes live state by hand. It is an exception to the GitOps rule because the bundle is a secret that git does not hold. Keep the bundle on /dev/shm, and never commit it.
Before you start#
- Install
talosctl,yq,jqandop, and sign in to thehomelabvault. - Run the commands from the repository checkout, so that mise resolves the tools. A
cdinto/dev/shmleaves them behind.
<site> is folly or offsite, and <checkout> is a checkout of the cutover branch.
Make the bundle#
Make the bundle with the cluster's signing key.
umask 077; T=$(mktemp -d -p /dev/shm talos.XXXX) talosctl gen secrets --talos-version v1.14 -o $T/secrets.yaml KEY=$(op read "op://homelab/talos-<site>-secrets/notesPlain" | yq -r '.certs.k8sserviceaccount.key') \ yq -i '.certs.k8sserviceaccount.key = strenv(KEY)' $T/secrets.yamlReplace the Secure Note
talos-<site>-secrets.op item delete talos-<site>-secrets --vault homelab op item template get "Secure Note" \ | jq --rawfile n $T/secrets.yaml '.title="talos-<site>-secrets" | .fields |= map(if .id=="notesPlain" then .value=$n else . end)' \ | op item create --vault homelab - --format json | jq -r .idResult: The UUID of the new item.
In the cutover pull request, set
secrets_item_uuidinclusters/<site>/talos/talos.tfto the UUID.
Pin the new CA#
Atlantis, Rowbutt and the kthx engine trust the cluster's API server through clusters/<site>/config/kubernetes-ca.pem.
In the cutover pull request, replace the pin with the new CA certificate.
yq -r '.certs.k8s.crt' $T/secrets.yaml | base64 -d > <checkout>/clusters/<site>/config/kubernetes-ca.pemIn the cutover pull request, write the kthx engine's CA bundle: offsite's pin, then folly's.
cd <checkout>; f=clusters/offsite/apps/kthx-engine/ca-bundle.yaml { sed -n '1,/^ ca.crt: |$/p' "$f"; cat clusters/offsite/config/kubernetes-ca.pem clusters/folly/config/kubernetes-ca.pem | awk 'NF {print " " $0}'; } > "$f.tmp" mv "$f.tmp" "$f"; cd -Commit both files to the cutover pull request.
Finish#
- Issue the admin talosconfig from
$T, as Issue a talosconfig describes. - Delete
$T.
If something goes wrong#
| Symptom | Cause | Action |
|---|---|---|
op read prints isn't an item. | The item name is wrong, or the op session is a service account without a vault. | Use the exact title, and pass --vault homelab to op item commands. |
mise ERROR No version is set for shim. | The shell left the checkout, so mise has no project tools. | Run the commands from the checkout and address $T by path. |
The Atlantis plan of clusters/<site>/talos fails with Create the talos-<site>-secrets Secure Note. | secrets_item_uuid is the placeholder. | Do step 3 of Make the bundle. |
Related#
Linked from 4
- RunbooksStep-by-step procedures for the hosts, clusters, network, secrets and apps, grouped by area.
- Rebuild a cluster on TalosReplace a cluster's NixOS nodes with Talos Linux, bootstrap a fresh etcd, install Cilium and Flux, and restore the data that has a backup.
- Rotate the cluster bootstrap tokenReplace folly's cluster-wide Kubernetes bootstrap token in the Talos secrets bundle, apply it to the nodes that carry it, and delete the old token.
- Verify a Talos clusterCheck a cluster that runs Talos after a rebuild or an upgrade, from the nodes and Cilium to federation, backups, OpenBao, the sandbox runtimes, the GPU and Falco.