
Table of Contents
By Khimananda Oli | Last reviewed: August 2026
Default Kubernetes Secrets are base64-encoded strings stored in etcd, not encrypted vaults, making Kubernetes Secrets Management Done Right a mandatory discipline for any production workload. Without explicit encryption-at-rest configuration and strict RBAC, anyone with read access to the API server or underlying storage can decode your database passwords and API keys in seconds. This guide replaces unsafe defaults with an external-first architecture that satisfies SOC 2 and ISO 27001 audit requirements while keeping developer velocity high.
Why Are Default Kubernetes Secrets Unsafe for Production?
A common mistake I see during security audits across Nepal and global clients is treating Kubernetes Secrets as a secure storage mechanism. They are not. By default, Kubernetes stores Secret objects in etcd as base64-encoded plaintext. Base64 is an encoding scheme, not encryption; any user or process with read access to etcd backups, API server logs, or cluster-admin privileges can trivially decode them.
In practice, this means your database credentials, TLS private keys, and third-party API tokens sit exposed in multiple locations: etcd snapshots, kube-apiserver audit logs (if misconfigured), node filesystems via volume mounts, and potentially in CI/CD artifact caches. For teams pursuing SOC 2 compliance automation, native Secrets fail CC6.1 and CC6.3 criteria because they lack encryption-at-rest by default, granular access controls, and audit trails for secret retrieval.
The risk compounds in multi-tenant clusters. Without namespace-scoped RBAC and network policies, a compromised pod in one namespace can enumerate Secrets across the entire cluster. Even in single-tenant environments, developers often accidentally commit base64-encoded secrets to Git repositories, assuming "it's just Kubernetes YAML." Always assume etcd will be breached eventually; design your secrets architecture so that breach yields only ciphertext.
How Do You Integrate External Secrets Providers with Kubernetes?
Kubernetes Secrets Management Done Right means decoupling secret storage from the cluster entirely. External providers like HashiCorp Vault, AWS Secrets Manager, Azure Key Vault, or GCP Secret Manager serve as the single source of truth. The cluster merely retrieves and injects secrets at runtime. Two primary integration patterns dominate production deployments in 2026: the External Secrets Operator (ESO) and the Secrets Store CSI Driver.
External Secrets Operator Pattern
ESO runs as a controller that watches ExternalSecret custom resources, fetches values from external providers, and creates native Kubernetes Secret objects. This approach works well when applications expect standard Secret volumes or environment variables but adds complexity because secrets still exist temporarily in etcd.
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: app-db-credentials
namespace: production
spec:
refreshInterval: 1h
secretStoreRef:
name: vault-backend
kind: ClusterSecretStore
target:
name: db-credentials
creationPolicy: Owner
data:
- secretKey: username
remoteRef:
key: secret/data/prod/db
property: username
- secretKey: password
remoteRef:
key: secret/data/prod/db
property: password Secrets Store CSI Driver Pattern
The CSI driver mounts secrets directly as in-memory volumes without creating Kubernetes Secret objects. Secrets never touch etcd, reducing attack surface significantly. This is my preferred pattern for new deployments because it enforces ephemeral secret lifecycle and supports automatic rotation without pod restarts.
apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata:
name: vault-prod-secrets
namespace: production
spec:
provider: vault
parameters:
vaultAddress: "https://vault.internal:8200"
roleName: "prod-app-role"
objects: |
- objectName: "db-password"
path: "secret/data/prod/db"
objectAlias: "password"
- objectName: "api-key"
path: "secret/data/prod/api"
objectAlias: "key" For teams evaluating options, I have detailed the operational trade-offs in my guide on secrets management with HashiCorp Vault. Choose CSI for greenfield workloads; choose ESO when migrating legacy apps that hard-depend on native Secret objects.
What RBAC Policies Prevent Unauthorized Secret Access?
Even with external providers, you must restrict who can request secrets within the cluster. Overly permissive RBAC is the second most frequent finding in my Kubernetes security assessments. Apply these principles systematically:
- Namespace-scoped roles only: Never grant ClusterRole bindings for secret access. Each namespace should have its own Role limiting get/list/watch on specific secret names.
- ServiceAccount isolation: Create dedicated ServiceAccounts per application. Disable automountServiceAccountToken unless the pod genuinely needs API access.
- Verb restrictions: Grant only
getfor mounted secrets; denylistandwatchto prevent enumeration attacks. - Network policy enforcement: Restrict egress from pods to only the external secrets provider endpoint. Block all other outbound traffic by default.
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: production
name: app-secret-reader
rules:
- apiGroups: [""]
resources: ["secrets"]
resourceNames: ["db-credentials"]
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: app-secret-binding
namespace: production
subjects:
- kind: ServiceAccount
name: prod-app-sa
namespace: production
roleRef:
kind: Role
name: app-secret-reader
apiGroup: rbac.authorization.k8s.io Audit every RoleBinding quarterly. Remove stale bindings immediately. In regulated environments, automate this review with OPA/Gatekeeper policies that reject overly broad secret permissions at admission time.
How Do You Enable Encryption at Rest for Kubernetes Secrets?
If you must use native Kubernetes Secrets (e.g., for backward compatibility), enable encryption-at-rest in etcd immediately. This does not replace external providers but adds defense-in-depth. Configure the kube-apiserver --encryption-provider-config flag with a KMS provider backed by AWS KMS, Azure Key Vault, or GCP Cloud KMS rather than local AES keys.
apiVersion: apiserver.config.k8s.io/v1
kind: EncryptionConfiguration
resources:
- resources:
- secrets
providers:
- kms:
name: aws-kms
endpoint: unix:///var/run/kmsplugin/socket
cachesize: 1000
timeout: 3s
- identity: {} Rotate encryption keys annually or after suspected compromise. Test decryption of existing secrets before removing old keys from the provider list. Remember: encryption-at-rest protects against physical theft of etcd disks and backup exposure, but does nothing against authenticated API users with list permissions. Combine with RBAC and external providers for complete coverage.
Which Secrets Management Approach Fits Your Compliance Requirements?
| Criteria | Native Secrets | ESO + Native | CSI Driver + Vault |
|---|---|---|---|
| Encryption at Rest | Manual KMS config | Depends on backend | Always (in-memory) |
| Audit Trail | API server logs only | Provider + API logs | Full Vault audit log |
| Auto-Rotation | No | Yes (polling) | Yes (push/mount) |
| SOC 2 CC6.1 Ready | No | Partial | Yes |
| Complexity | Low | Medium | High (initial) |
| Best For | Dev/test only | Legacy migration | Production/regulatory |
For Nepali fintech companies handling eSewa or Khalti integrations, or any team processing payment data, the CSI + Vault pattern is non-negotiable. The audit trail alone satisfies regulatory evidence requests that would otherwise require weeks of manual log correlation. Global teams targeting ISO 27001 certification should adopt the same standard; auditors increasingly expect externalized secrets as baseline hygiene.
Implementing Kubernetes Secrets Management Done Right Today
Start by auditing your current secret usage: run kubectl get secrets --all-namespaces and classify each by sensitivity. Migrate high-sensitivity credentials to an external provider first, beginning with database passwords and API keys. Enable etcd encryption-at-rest as immediate mitigation for remaining native secrets. Implement CSI driver or ESO based on your application compatibility, then enforce RBAC and network policies before your next audit cycle.
If your team needs hands-on guidance implementing Kubernetes Secrets Management Done Right — whether for SOC 2 preparation, multi-cluster secret synchronization, or Vault PKI integration for dynamic TLS certificates — reach out to discuss your infrastructure. I help teams build secret architectures that survive both traffic spikes and compliance reviews without slowing down deployments.