Challenge - 5 Problems
Secret Volume Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Output of pod with secret mounted as volume
You have a Kubernetes pod that mounts a secret as a volume at
/etc/secret-volume. The secret contains a key password with value mypassword. What will be the output of cat /etc/secret-volume/password inside the pod?Kubernetes
kubectl exec pod-secret-volume -- cat /etc/secret-volume/password
Attempts:
2 left
💡 Hint
Secrets mounted as volumes are decoded automatically and stored as plain text files.
✗ Incorrect
When a secret is mounted as a volume, Kubernetes decodes the base64 encoded data and writes the plain text content to files named after the secret keys. So the file /etc/secret-volume/password contains the plain text 'mypassword'.
❓ Configuration
intermediate2:00remaining
Correct secret volume mount configuration
Which of the following YAML snippets correctly mounts a secret named
db-secret as a volume at /etc/db inside a pod?Attempts:
2 left
💡 Hint
The secret volume must specify 'secretName' and volumeMount must use 'mountPath'.
✗ Incorrect
Option B correctly uses 'secretName' under 'secret' and 'mountPath' under 'volumeMounts'. Option B uses configMap instead of secret. Option B uses 'secretName' correctly (fixed from 'name'). Option B uses 'path' instead of 'mountPath'.
❓ Troubleshoot
advanced2:00remaining
Reason for secret volume files missing in pod
You mounted a secret as a volume in your pod, but when you exec into the pod, the secret files are missing from the mount path. What is the most likely cause?
Attempts:
2 left
💡 Hint
Check if the secret name in the volume matches an existing secret.
✗ Incorrect
If the secret name in the volume does not match any existing secret, Kubernetes cannot mount it, so the files will be missing. RBAC does not restrict secret volume mounts. Environment variables are different from volume mounts. Container images do not affect volume mounting.
🔀 Workflow
advanced2:00remaining
Steps to update a secret mounted as volume in a running pod
You updated a Kubernetes secret that is mounted as a volume in a running pod. What is the correct way to see the updated secret files inside the pod?
Attempts:
2 left
💡 Hint
Secret volumes are mounted at pod start and do not update automatically.
✗ Incorrect
Kubernetes mounts secret volumes at pod start. Updating the secret does not update the files inside running pods. You must delete and recreate the pod to see changes. Option D is incorrect because files do not update automatically. Option D is invalid because 'kubectl rollout restart' applies to deployments, not containers. Option D is false; no automatic refresh occurs.
✅ Best Practice
expert2:00remaining
Best practice for restricting secret volume file permissions
You want to mount a secret as a volume but restrict the file permissions so only the owner can read the secret files inside the pod. Which volume configuration option achieves this?
Attempts:
2 left
💡 Hint
File permission modes control access rights; 0400 means read by owner only.
✗ Incorrect
The 'defaultMode' field under the secret volume controls the permission bits of the mounted files. Setting it to 0400 makes files readable only by the owner. 'readOnly' only prevents writing but does not restrict read permissions. 'fsGroup' controls group ownership, not file permissions. 0777 gives full permissions to all, which is insecure.