How do you make sure Kubernetes Secrets are encrypted at rest in etcd?
IntermediateScenarioKubernetes Security
Answer
Situation read → Secrets are base64, not encrypted. Anyone with an etcd backup can read them unless encryption is configured.
What I'd do →
- Managed: on EKS enable envelope encryption with a KMS key (
aws eks associate-encryption-config); recent EKS versions encrypt by default, but a customer KMS key gives control and audit. - Self-managed:
EncryptionConfigurationwith thekmsv2 provider, passed via--encryption-provider-config. - Re-encrypt existing Secrets:
kubectl get secrets -A -o json | kubectl replace -f -. - Protect etcd backups and restrict
get/liston secrets in RBAC.
Why → Encryption at rest protects against stolen disks and backups, not against users who can read secrets through the API.
Interview tip → Say clearly that base64 is encoding, not encryption.
More on Kubernetes Security
What are the 4Cs of cloud native security?BeginnerWhat happens to a request between `kubectl apply` and etcd from a security point of view?IntermediateExplain Role, ClusterRole, RoleBinding and ClusterRoleBinding.BeginnerHow do you check what a user or service account is allowed to do?BeginnerWhich RBAC permissions are effectively cluster-admin in disguise?AdvancedHow do service account tokens work now, and what is `automountServiceAccountToken`?Intermediate