What is the safe procedure for rotating Hetzner credentials?
To rotate the Hetzner API token for Kubernetes clusters on Syself Autopilot, create the new token first, then update the hetzner Secret in the management cluster. Revoke the old token only after your clusters use the new one, so they never run without a valid token.
For the Hetzner Cloud API token:
Create a new API token with read and write permissions in the same Hetzner Cloud project.
On the management cluster, set the new token as the
hcloudkey of thehetznerSecret in your namespace:plaintext kubectl patch secret hetzner --type merge -p '{"stringData":{"hcloud":"<new-token>"}}'Syself Autopilot copies the Secret into the
kube-systemnamespace of each workload cluster that uses it. On each of these clusters, check that the new token arrived. This prints the last characters of the token, which is enough to compare:plaintext kubectl -n kube-system get secret hetzner -o jsonpath='{.data.hcloud}' | base64 -d | tail -c 8On each workload cluster, restart the Hetzner Cloud storage driver (CSI), so it reads the new token. The cloud controller manager picks up the new token on its own.
plaintext kubectl -n kube-system rollout restart deployment csi-controllerRevoke the old token in the Hetzner Cloud Console.
For the Hetzner Robot webservice user, there is no overlap. The old password stops working as soon as you change it in Hetzner Robot. Change it, then update the robot-user and robot-password keys of the same Secret right away, so bare-metal provisioning is not held up:
kubectl patch secret hetzner --type merge -p '{"stringData":{"robot-user":"<user>","robot-password":"<new-password>"}}'
The token and the Secret come from the setup in Connect your Hetzner account. If you are not sure which clusters share a Secret, see Can each cluster use its own Hetzner project or secret?
Related questions
