
It is broadly known that Kubernetes secrets are not encrypted by default. They are merely Base64-encoded, and anyone with sufficient cluster or etcd access can easily read them in plaintext.
Yet teams still fail to address this security gap. To ensure that secrets used within Kubernetes are properly protected, three layers of protection are needed. They are encryption at rest in etcd, RBAC scoped to the namespace and secret levels, and an external secrets manager that keeps the source of truth outside the cluster.
This article explains why this security gap persists in most teams and how to achieve these protection layers.
When Kubernetes Secrets are represented as Base64-encoded strings, this is just a way to represent their data. Base64 is an encoding scheme, not a security mechanism. While the object is named Secret, the Kubernetes API server does not apply any cryptographic protections or hashing when these object attributes are declared under data in the manifest.
Kubernetes Secret objects are primarily a storage convenience that decouples credentials from pod container images and manifest files. This helps you avoid putting credentials directly into your Pod or Deployment manifests. Out of the box, these Secret objects are often just Base64-encoded sensitive data with weak operational safeguards. Treat them as a convenience layer, not a security boundary.
A simple kubectl get secret command can expose a secret in plaintext.
There are actually three primary vectors through which these secrets can be exposed: direct etcd access, coarse namespace privileges, and Pod environment variables.
By default, Kubernetes does not encrypt secret values at rest in etcd. Secret objects are stored under keys such as /registry/secrets/<namespace>/<secret-name>. If the etcd data is not encrypted at rest, an etcd snapshot saved for backup can contain these secrets in plaintext.
In Kubernetes RBAC, a user or service account granted get, list, or watch permissions on Secret objects in a namespace can read Secret data within that scope. So if you give a CI/CD runner list permission on Secret objects in a production namespace, it can retrieve all production API keys and database credentials.
When you inject secrets via env or envFrom, the kubelet makes secret values available to the container as environment variables. Processes with sufficient access to the container can read environment variables through /proc/1/environ. Also, applications or debugging tools can expose them in process dumps, logs, or telemetry if they capture the process environment.
The question is: If these exposure vectors can easily reveal these secrets, why is there no urgency to fix them?
One reason teams may leave this security gap unresolved is that development speed and deployment simplicity can take priority over more complex security configuration. For them, the gap may not receive the attention it needs until it becomes a blocker. Let's explore some reasons.
Unlike an out-of-memory container, Kubernetes Secrets without encryption at rest still work: the pods start up, database connections succeed, and traffic flows. There is no immediate visible failure that would prompt a security refactoring.
For some teams, an audit or compliance requirement becomes the forcing function for closing this gap. Security audits and compliance assessments against frameworks such as SOC 2 and ISO 27001 can flag unencrypted etcd Secrets as findings, prompting the team to act. Even so, when auditors bring these gaps to light, it is the worst possible time. Fixing the vulnerabilities during an active audit window creates pressure and high-risk emergency migrations. For example, if an application switches over before the new secret surface is tested, a failed migration could cause workloads that depend on that credential to fail.
When the same credential is copied into 10 to 15 different Secret objects across dev, staging, prod, and custom namespaces, secrets can spread beyond where you put them. A single rotation could break unexpected systems. Updating a database password could mean manually updating 15 manifests across multiple repositories or kubectl contexts. In microservices, a missed step during a manual credential update could lead to silent failures that surface as costly errors later. Teams end up avoiding rotation, thereby extending the blast radius of any exposure to the Secret object indefinitely.
These reasons shouldn't stop you from addressing this security gap, especially when you weigh the risk of a breach. Protecting Kubernetes Secrets isn't as complex as it is made to look. It involves covering three important areas.
Below are three layers of protection required to secure Kubernetes Secrets.
This layer is configured via the --encryption-provider-config flag on the kube-apiserver, pointing to an EncryptionConfiguration file. The kube-apiserver encrypts secret values before they are stored in etcd using providers such as secretbox or envelope encryption through KMS providers such as AWS KMS and Google Cloud KMS. Managed Kubernetes services such as EKS, GKE, and AKS abstract these configurations and offer encryption at rest.
Overly broad RBAC permissions in Kubernetes can give users or service accounts access to more Secrets than they need. Scope access to specific Secrets in specific namespaces. For example, you can scope access to a specific Secret using resourceNames and limit the allowed actions with verbs.
This permits updating the Secret payload without granting permission to read it back through a get request. If an attacker compromises the environment and runs kubectl get secret payment-service-db-credentials, the API server denies the request.
It's even safer to decouple secrets lifecycle management entirely from Kubernetes manifests management. Use a secrets management solution, such as Doppler, to store the actual secret values and have the cluster retrieve them. The secrets are synced directly to Secret objects that are encrypted at rest and guarded by least-privilege access from the first two layers.
Together, these three layers provide stronger protection for Kubernetes Secrets. The syncing from the external source of truth to Secret objects is made possible by the External Secrets Operator (ESO). Here is how to implement it with Doppler.
The ESO is the community-standard, vendor-neutral operator for syncing secrets from external providers into Kubernetes. It uses CustomResourceDefinitions to configure access to secret providers via SecretStore resources and to manage Kubernetes Secret resources via ExternalSecret resources. Doppler is a supported SecretStore provider. The following steps show how to set it up with Doppler.
Use Helm to install the External Secrets Operator in your cluster.
To establish cluster-wide access, store a Doppler service token as a native Kubernetes Secret inside the external-secrets namespace.
Generate a Doppler service token, then run the following command:
This command requires Python 3 and an interactive terminal. When prompted, paste the token and press Enter. The command passes the token to kubectl through standard input rather than including it in the command line. Python’s getpass hides the input as you enter it.
Then, define the ClusterSecretStore manifest:
This resource maps keys stored in Doppler to native Kubernetes Secret keys in an application namespace.
Create the namespace first:
Then apply the following manifest:
The auth-api-db-secrets resource is the ExternalSecret, while auth-api-k8s-secret is the Kubernetes Secret generated by ESO. Also note that the secretKey and remoteRef.key names can differ, as shown by mapping LOGGER_API_KEY in Doppler to API_KEY in the Kubernetes Secret.
The Kubernetes manifests now hold only a reference to the remote secret. To replicate this configuration in your workflow, sign up for a free Doppler account.
Run the command below to verify the sync status.
The expected output should include a Status: True, Reason: SecretSynced, and the target binding as auth-api-k8s-secret.
ESO checks Doppler based on the configured refreshInterval, which is set to one hour in this example. When you update the LOGGER_API_KEY in the Doppler dashboard, ESO detects the version change at the refresh interval and updates the native auth-api-k8s-secret in etcd.
Applications mounting the Secret as a volume can receive updates without pod restarts, provided the application rereads the mounted Secret. However, Secret volumes mounted using subPath do not receive automatic updates. Secrets injected as environment variables through env or envFrom do not refresh in running containers; restart the pods to pick up the updated values.
This ESO setup works for both new and existing secrets. However, migrating existing secrets requires care.
Follow these steps to migrate existing secrets to ESO safely.
Aside from ESO, Doppler offers another way to sync with Kubernetes.
While ESO is vendor-neutral, Doppler provides a Kubernetes Operator as a Doppler-specific alternative for syncing secrets into Kubernetes. It supports automatic Deployment restarts when secrets change. To enable this behavior when Doppler’s operator is configured, add the following annotation to the Deployment’s metadata.annotations:
This annotation triggers a Deployment restart when its managed Secret changes. This lets applications pick up updated environment variables or mounted secrets without implementing logic to reread them.
You now have encryption at rest, scoped RBAC, and an external source of truth in Doppler, with ESO handling the synchronization. Together, these layers address the security gaps created by relying on Kubernetes Secrets as a storage convenience and provide stronger protection for the secrets they contain. The next step is to run kubectl get secrets --all-namespaces and count how many Secrets exist across your cluster. That number gives you a baseline for your secrets management surface and an inventory problem to tackle first.






Protect secrets across your entire stack with centralized management, automated workflows, and the flexibility to deploy in the cloud or on-prem.
