Rotate SSH Keys¶
Machine Config Operator Documentation | KCS: Updating SSH keys
Note
SSH authorized-key updates are applied by the Machine Config Operator without draining or rebooting nodes. Monitor with oc get mcp until UPDATED=True.
Steps¶
-
Generate a new key:
-
Export the existing MachineConfig:
-
Edit to include both the old and new keys:
apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig metadata: labels: machineconfiguration.openshift.io/role: master name: 99-master-ssh spec: config: ignition: version: 3.5.0 passwd: users: - name: core sshAuthorizedKeys: - ssh-ed25519 AAAA...your_old_key_here... - ssh-ed25519 AAAA...your_new_key_here... -
Apply:
-
Repeat for Worker Nodes using
99-worker-sshinstead of99-master-ssh -
Once all nodes show
UPDATED=Trueinoc get mcp, verify SSH access with the new key: -
After confirming the new key works, remove the old key from the MachineConfig and reapply