Explore our new Cybersecurity Terms Glossary, explained by our experts.

View the Glossary View the Glossary
PRIVIA

Cybersecurity Terms Glossary

How Do You Encrypt Kubernetes Secrets?

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.

Illustration for the cybersecurity term Kubernetes Secrets Encryption
Home / Blog / Cybersecurity Terms / How Do You Encrypt Kubernetes Secrets?
17 November 2026

How Do You Encrypt Kubernetes Secrets?

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.

What Base64 Really Costs You

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.

Envelope Encryption at Rest

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.

Access Control Beats Cipher Choice

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.

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.

External Managers and GitOps

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.

The Details That Catch People Out

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.

FAQ – Frequently Asked Questions

Does Enabling Encryption at Rest Protect Existing Secrets?

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.

Should I Use an External Vault Instead of Kubernetes Secrets?

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.

Is aescbc Encryption Good Enough?

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.

Can Developers Read Secrets They Do Not Have RBAC Access To?

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.

Related Terms

You May Be Interested In These

What Is Autopsy?

Cybersecurity Terms

17 November 2026

What Is Autopsy?

Read More
What Is a Golden Ticket Attack?

Cybersecurity Terms

17 November 2026

What Is a Golden Ticket Attack?

Read More