Certified Kubernetes Application Developer (CKAD) · Free practice question 11 of 12
Ways to consume a Secret in a container
A developer at Carbis Labs must give a container access to the `api-key` value stored in Secret `vendor-creds`. Which approaches are valid? (Select TWO.)
- A.A Pod annotation secret.kubernetes.io/inject: vendor-creds
- B.An env entry with valueFrom.secretKeyRef naming vendor-creds and key api-key
- C.A volume of type secret for vendor-creds, mounted into the container
- D.An envFrom entry with secretKeyRef naming vendor-creds and key api-key
- E.An env entry with valueFrom.configMapKeyRef naming vendor-creds
Show answer and explanation
Correct answers: B. An env entry with valueFrom.secretKeyRef naming vendor-creds and key api-key · C. A volume of type secret for vendor-creds, mounted into the container
Why: Secrets reach containers through env variables (valueFrom.secretKeyRef for one key, or envFrom with secretRef for all keys) or as files from a secret volume. configMapKeyRef reads ConfigMaps, not Secrets. envFrom takes secretRef rather than secretKeyRef, and no built-in annotation injects Secrets.
More free Certified Kubernetes Application Developer (CKAD) questions
- Generating a Pod manifest skeleton
- Downward API Pod IP as env
- fsGroup for shared volume ownership
- Indexed Job completion index
- Pulling and unpacking a chart locally
- Kustomize namePrefix and references
- Watching Pod status changes live
- tcpSocket probe for a non-HTTP server
- ExternalName Service for an outside host
- StatefulSet per-Pod DNS name
- Checking quota usage in a namespace