I was working through the CKAD mock test by CNCF on Killer Shell and question 14 goes like this:
Create a new Secret
secret1which containsuser=testandpass=pwd. The Secret’s content should be available in Podsecret-handleras environment variablesSECRET1_USERandSECRET1_PASS.
The provided solution configures the pod like so:
- name: SECRET1_USER # add
valueFrom: # add
secretKeyRef: # add
name: secret1 # add
key: user # add
- name: SECRET1_PASS # add
valueFrom: # add
secretKeyRef: # add
name: secret1 # add
key: pass # add
However, searching the Kubernetes documentation for secretKeyRef does not yield any references to this structure, except for:
For each container in your Pod specification, add an environment variable for each Secret key that you want to use to the
env[].valueFrom.secretKeyReffield
But this text doesn’t provide the name & value structure referenced in the mock test solution.
Have I got this wrong or is this a gap in the docs?