Secrets Leaked in Environment Variables
advanced
30 minInstructions
An application running in the staging
namespace was deployed with a database password hardcoded in the Pod's env
section.
Your mission:
- Refactor the deployment to use a Kubernetes Secret.
- Ensure the password is no longer visible using
kubectl describe pod
. - Ensure the pod restarts with the same configuration and environment access.
Bonus: Check that the Secret is not mounted as a volume, only injected as an environment variable.