Why do Kubernetes clusters use encryption at rest for secrets?
Think about what happens if someone gets physical access to the storage where secrets are saved.
Encryption at rest protects secret data stored on disk by making it unreadable without the encryption key. This prevents unauthorized users from accessing secrets even if they get access to the storage.
Given the following snippet in the EncryptionConfiguration file, what will be the effect on stored secrets?
apiVersion: apiserver.config.k8s.io/v1
encryptionConfig:
resources:
- resources:
- secrets
providers:
- aescbc:
keys:
- name: key1
secret: c2VjcmV0a2V5MTIzNDU2Nzg5MA==
- identity: {}The order of providers matters. The first provider that can encrypt is used.
The AES-CBC provider is listed first, so secrets are encrypted using AES-CBC with the given key. The identity provider is fallback and stores data unencrypted only if encryption fails.
You enabled encryption at rest for secrets in Kubernetes, but when you check etcd data, secrets appear in plain text. What could be the cause?
Think about what is required for the API server to apply new config changes.
The API server must be restarted to load the new encryption configuration. Without restart, it continues to store secrets unencrypted.
Arrange the following steps in the correct order to enable encryption at rest for secrets in a Kubernetes cluster.
Think about safety first, then config, then restart, then verify.
Backing up secrets first prevents data loss. Then create the config, restart API server to apply, and finally verify encryption.
You need to rotate the encryption keys used for secrets at rest. Which practice ensures minimal downtime and data safety?
Consider how Kubernetes decrypts and re-encrypts secrets during key rotation.
Adding the new key first allows the API server to encrypt new secrets with it, while still decrypting old secrets with the old key. This enables smooth rotation without data loss.