Vault
Rotate the key encryption key
You can rotate the KEK in Vault without restarting the vault-kube-kms process or the
Kubernetes API server. During the rotation process, the vault-kube-kms process emits
log entries indicating that it observed a new Transit key version along with the
results of encryption operations using the new key version.
To rotate the KEK, call the Transit rotate endpoint with the key name configured
for the vault-kube-kms process:
$ vault write -f <mount_path>/keys/<key_name>/rotate
For example:
$ vault write -f k8s-transit/keys/kms-kek/rotate
Vault creates a new version of the key while retaining previous versions for decryption. Once you rotate the key in Vault:
- The
vault-kube-kmsprocess automatically detects the new Transit key version. - Within a few minutes of rotation, the
vault-kube-kmsprocess updates the active key version used for encryption. - The Kubernetes API server encrypts the new DEK using the latest key version. Refer to the Kubernetes doc, Understanding key_id and Key Rotation for more details on the timing.
- Existing encrypted DEKs remain decryptable using older key versions.