CKAD lab · Mount a lab Secret as a file
A workload reads a short-lived lab setting from a file.

Initial conditions
Use a disposable namespace lab and a dummy value. Save the manifest as secret-pod.yaml.
Objective
Mount the Secret at /run/ep and verify that the file exists without printing its contents.
Hint
The Secret key becomes the filename in the mounted directory.
Solution manifest
apiVersion: v1
kind: Pod
metadata:
name: secret-demo
spec:
containers:
- name: worker
image: busybox:1.36
command: ["sleep", "3600"]
volumeMounts:
- name: settings
mountPath: /run/ep
readOnly: true
volumes:
- name: settings
secret:
secretName: demo-settingSolution commands
kubectl -n lab create secret generic demo-setting --from-literal=token=lab-placeholder
kubectl -n lab apply -f secret-pod.yamlValidate the result
kubectl -n lab wait --for=condition=Ready pod/secret-demo --timeout=60s
kubectl -n lab exec secret-demo -- test -f /run/ep/tokenA successful exit confirms the file exists without displaying it. Kubernetes Secrets need appropriate access and at-rest protections.
Common mistakes
Base64 encoding is not encryption. Use a dummy value in training and avoid printing production secrets.
Free official documentation · Verified 26 November 2026
Use your own disposable Kubernetes environment.
