Mounting Secrets into Kubernetes Pods via Secrets Store CSI DriverBrief · digest for November 5
Brief≈ 1 min

Mounting Secrets into Kubernetes Pods via Secrets Store CSI Driver

If you create a standard Secret in a cluster, its base64-encoded contents end up in etcd. Without KMS encryption in the cluster, any dump or overly broad RBAC permissions in the namespace grant direct access to services, and manual key rotation turns into a chore.

The Secrets Store CSI Driver project solves this elegantly: instead of duplicating secrets in etcd, it talks to an enterprise vault—such as HashiCorp Vault or AWS Secrets Manager—and mounts keys directly into the pod's memory as a tmpfs volume.

The binding is declared in a SecretProviderClass manifest:

apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata:
  name: app-vault-secrets
spec:
  provider: vault
  parameters:
    vaultAddress: "https://vault.internal:8200"
    roleName: "app-role"
    objects: |
      - objectName: "db-password"
        secretPath: "secret/data/db"
        secretKey: "password"

And in the pod spec, the volume is attached via the inline driver:

volumes:
  - name: secrets-store-inline
    csi:
      driver: secrets-store.csi.k8s.io
      readOnly: true
      volumeAttributes:
        secretProviderClass: "app-vault-secrets"

The driver also supports background auto-rotation: when a password is updated in Vault, the file inside the container updates on the fly.

Want a deep diveVotes help us choose what to break down in detail. This material has 0 votes.
Sources · 2