SecretKeyRef
SecretKeyRef is a reference mechanism used in Kubernetes to obtain a value from a Secret for a container’s configuration, most commonly to populate environment variables. It points to a specific key within a Secret rather than the entire Secret, allowing for granular access control and flexible deployment.
In manifests, SecretKeyRef appears as part of an environment variable source (EnvVarSource) under secretKeyRef. The essential
Usage examples include setting an environment variable from a Secret: env: - name: DB_PASSWORD valueFrom: secretKeyRef: name:
Operational considerations: Secrets in Kubernetes are stored as base64-encoded data and are subject to RBAC controls.