Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
A Kubernetes Secret is base64-encoded, not encrypted. Protecting one means enabling envelope encryption at rest, tightening RBAC, and deciding whether an external vault should hold it.

How Do You Encrypt Kubernetes Secrets?
A Kubernetes Secret is not encrypted. By default it is a base64-encoded value held in etcd, readable by anyone who can reach that datastore or who holds get rights on secrets in the namespace. Encrypting Kubernetes Secrets properly is three separate pieces of work: switching on encryption at rest in the API server, controlling who can read secrets through the API, and deciding whether an external secret manager should hold the material at all.
Run kubectl get secret db-credentials -o jsonpath='{.data.password}' | base64 -d and the password appears on your terminal. The same value sits in plain sight in etcd snapshots, in the backup that copies them, and on whatever volume or object store those backups land in. On a self-managed cluster, an etcd snapshot left in a CI artefact is a complete credential dump for every namespace at once. The Kubernetes Hardening Guidance published jointly by the NSA and CISA treats secret handling as a control plane problem for exactly this reason.
The API server reads an EncryptionConfiguration file supplied through --encryption-provider-config. Providers are tried in order on reads; the first entry is used for writes, so ordering is the switch that turns encryption on or off.
apiVersion: apiserver.config.k8s.io/v1
kind: EncryptionConfiguration
resources:
- resources: ["secrets"]
providers:
- kms:
apiVersion: v2
name: cluster-kms
endpoint: unix:///var/run/kmsplugin/socket.sock
- identity: {}
The local providers are a compromise. aescbc offers no integrity protection, aesgcm demands disciplined key rotation, and all of them keep the key in a file on the control plane node, so whoever takes the node takes both ciphertext and key. KMS v2, which became generally available in Kubernetes 1.29, is the option to aim for: the data encryption key is wrapped by a key held in AWS KMS, Azure Key Vault, Google Cloud KMS, or HashiCorp Vault, and v2 added key ID tracking plus far better performance than the original plugin interface.
Enabling the provider does not rewrite what is already stored. Existing secrets stay in their previous form until something updates them, so follow the change with kubectl get secrets --all-namespaces -o json | kubectl replace -f - and confirm the result by reading a key directly out of etcd. On managed platforms the control plane flags are not yours to set: use EKS envelope encryption with a customer-managed KMS key, AKS etcd encryption with Azure Key Vault, or GKE application-layer secrets encryption.
Encryption at rest defends against someone who steals the disk or the backup. It does nothing against an identity that can simply ask the API server. Two habits matter more than the algorithm you pick.
list or watch on secrets across a namespace exposes every secret in it, including service account tokens. Cluster-wide secret read access should belong to almost nobody, and role-based access control reviews should treat it as a privileged permission.get secret while handing out broad deployment rights achieves nothing.Set the audit policy for the secrets resource to Metadata level. At RequestResponse level the API server writes secret bodies into the audit log, which usually ships to a system with weaker access control than the cluster.
Many teams now treat Kubernetes as a consumer of secrets rather than a store. The External Secrets Operator and the Secrets Store CSI Driver pull values from a central vault at pod start, so rotation happens in one place and the cluster holds nothing long-lived. For GitOps workflows where manifests must live in a repository, Sealed Secrets encrypts values against a controller public key, and SOPS encrypts individual YAML fields with age or a cloud KMS key. Either approach is safer than a plain manifest, though neither removes the need for encryption at rest once the value reaches etcd.
/proc, and debug endpoints.immutable: true to stop accidental overwrites and reduce API server load.automountServiceAccountToken: false where a pod does not call the API.If you want to know what an attacker could actually reach from inside one of your pods, our cloud security services test clusters from that starting point rather than from a configuration checklist.
No. The API server only encrypts a secret when it next writes it, so everything created before the change stays in its old form. After updating the encryption configuration and restarting the API servers, force a rewrite of every secret, then verify by reading a key directly from etcd. Until you do, an etcd snapshot still exposes the original values in plain text.
Usually yes for anything shared beyond one cluster. A central manager such as HashiCorp Vault, AWS Secrets Manager, or Azure Key Vault gives you one rotation point, proper audit trails, and dynamic credentials that expire. Kubernetes Secrets remain convenient for cluster-local values. The two are not mutually exclusive: the External Secrets Operator syncs from a vault into native Secrets.
It is better than nothing but it is no longer recommended. The aescbc provider lacks integrity protection, and like every local provider it stores the key in a file on the control plane node, so one compromised node gives up both the encrypted data and the means to decrypt it. Use a KMS v2 provider backed by an external key management service wherever the platform allows it.
Often, yes. If a developer can create a pod or a job in a namespace, they can mount any secret in that namespace and read it from inside the container. Exec access into a running pod has the same effect. Treat pod creation, exec, and port-forward rights in a sensitive namespace as equivalent to secret read access when you review permissions.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.