CertKeen

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.)

  1. A.A Pod annotation secret.kubernetes.io/inject: vendor-creds
  2. B.An env entry with valueFrom.secretKeyRef naming vendor-creds and key api-key
  3. C.A volume of type secret for vendor-creds, mounted into the container
  4. D.An envFrom entry with secretKeyRef naming vendor-creds and key api-key
  5. 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