← Back to all fixes
Secret value is empty or unavailable in pod
The Issue
You defined an env var from a Secret in your Deployment, but inside the pod the variable is empty.
Root Cause
Secret does not exist in the same namespace, key name is wrong, or Secret was not base64 encoded correctly when created manually.
How to Fix
Verify the secret exists: `kubectl get secret <secret-name> -n <namespace>`Check the key: `kubectl get secret <secret-name> -o jsonpath="{.data}" | python3 -m json.tool`Decode to verify value: `kubectl get secret <secret-name> -o jsonpath="{.data.MY_KEY}" | base64 -d`Ensure namespace matches — secrets are namespace-scopedAfter fixing the secret, restart the deployment: `kubectl rollout restart deployment/<name>`