Refer to Exhibit.

Context
You are tasked to create a secret and consume the secret in a pod using environment variables as follow:
Task
* Create a secret named another-secret with a key/value pair; key1/value4
* Start an nginx pod named nginx-secret using container image nginx, and add an environment variable exposing the value of the secret key key 1, using COOL_VARIABLE as the name for the environment variable inside the pod
Suggested Answer: A
Get Premium CKAD Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
29 comments · newest first
VE
Veronika
7 months ago
I agree, key1 must match exactly.
TA
Tawny
7 months ago
Don't forget to check the key names!
JA
Jaclyn
7 months ago
I prefer option C, it seems clearer.
SY
Sylvie
7 months ago
I feel confident about it.
AM
Amira
8 months ago
This question is tricky!
DO
Dolores
8 months ago
I thought we were supposed to avoid using environment variables for secrets?
NO
Nobuko
8 months ago
Just make sure to use the right container image, nginx is perfect!
CA
Carlee
8 months ago
Wait, can you really expose secrets like that? Seems risky.
ET
Ethan
9 months ago
Totally agree, that's the right way to do it!
ED
Edmond
9 months ago
You need to create a secret named another-secret with key1/value4.
WI
Willie
9 months ago
Haha, I bet the exam writers had a good laugh coming up with "COOL_VARIABLE" as the environment variable name. Gotta love those creative touches!
EL
Elmer
9 months ago
Option C looks good, but I'm still a bit confused about the environment variable name. Shouldn't it be something more descriptive?
LU
Lucina
9 months ago
I agree, C is the way to go. Straight to the point and gets the job done.
LA
Laticia
10 months ago
The correct answer is C. That's the easiest way to create a secret and consume it in a pod.
KI
Kimbery
10 months ago
I definitely recall the steps for creating a pod, but I’m uncertain if I need to specify the secret in the pod definition or just in the environment section.
DE
Delisa
10 months ago
This question seems similar to one we practiced where we had to expose a config map as an environment variable. I hope I can apply that knowledge here.
NA
Na
10 months ago
Ah, I see what I need to do now. I'll create the secret first, then in the pod definition I'll use the `env` field to reference the secret value by its key. Simple!
GE
Germaine
10 months ago
I'm a little confused about the difference between the `env` and `envFrom` fields in the pod definition. I'll need to double-check the documentation to make sure I'm using the right one for this task.
MA
Marylou
10 months ago
I think I remember how to create a secret, but I'm not entirely sure about the exact command syntax.
ME
Merissa
11 months ago
No problem, I've done this kind of task before. I'll use the `kubectl create secret` command to create the secret, and then in the pod definition I'll use the `env` field to expose the secret value as an environment variable.
AV
Avery
11 months ago
I think option A looks good.
ED
Edwin
11 months ago
I feel a bit confused about the naming conventions for the environment variable. Was it COOL_VARIABLE or something else?
MI
Mirta
11 months ago
Hmm, I'm a bit unsure about how to create the secret and then reference it in the pod. I'll need to review the syntax for that.
LA
Lanie
12 months ago
Okay, this looks straightforward. I'll start by creating the secret with the key/value pair, then I'll create the nginx pod and add the environment variable to expose the secret value.
FE
Felicidad
6 months ago
And for the pod, you'll use `kubectl run` with the right flags, right?
DE
Deeann
6 months ago
I think `kubectl create secret` is the way to go.
VA
Vanna
6 months ago
What command will you use to create the secret?
FR
Franchesca
7 months ago
Don't forget to name the secret correctly!
AN
Angelo
11 months ago
Sounds good! Make sure to double-check the key/value pair.