0
0
Kubernetesdevops~20 mins

Creating Secrets in Kubernetes - Practice Exercises

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Secret Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Output of kubectl create secret generic command
What is the output of this command when creating a secret named mysecret with a literal key-value pair?
Kubernetes
kubectl create secret generic mysecret --from-literal=username=admin
Asecret/mysecret created
Berror: resource not found
Csecret/mysecret updated
Derror: invalid syntax
Attempts:
2 left
💡 Hint
Think about what kubectl reports when a new secret is successfully created.
🧠 Conceptual
intermediate
2:00remaining
Base64 encoding in Kubernetes Secrets
Why does Kubernetes require secret data to be base64 encoded in YAML manifest files?
ATo compress the secret data for faster transmission
BTo ensure the data is encrypted at rest
CTo allow binary data to be safely stored in text files
DTo convert data into a human-readable format
Attempts:
2 left
💡 Hint
Think about how YAML files handle binary or special characters.
Configuration
advanced
3:00remaining
Correct YAML for a Kubernetes Secret with two keys
Which YAML manifest correctly creates a secret named db-secret with keys username and password base64 encoded?
A
apiVersion: v1
kind: Secret
metadata:
  name: db-secret
data:
  username: admin
  password: password
B
apiVersion: v1
kind: Secret
metadata:
  name: db-secret
data:
  username: YWRtaW4=
  password: cGFzc3dvcmQ=
C
apiVersion: v1
kind: Secret
metadata:
  name: db-secret
stringData:
  username: admin
  password: password
D
apiVersion: v1
kind: Secret
metadata:
  name: db-secret
stringData:
  username: YWRtaW4=
  password: cGFzc3dvcmQ=
Attempts:
2 left
💡 Hint
Check which field requires base64 encoded values and which accepts plain text.
Troubleshoot
advanced
3:00remaining
Troubleshooting secret not found error in Pod
A Pod fails to start with error: secret "mysecret" not found. Which is the most likely cause?
AThe secret was created in a different namespace than the Pod
BThe secret data is not base64 encoded
CThe secret name contains uppercase letters
DThe Pod spec does not include a volume mount
Attempts:
2 left
💡 Hint
Remember that Kubernetes resources are namespace-scoped unless specified otherwise.
🔀 Workflow
expert
4:00remaining
Order of steps to update a Kubernetes Secret safely
What is the correct order of steps to update a Kubernetes Secret without downtime for Pods using it?
A1,4,2,3
B2,1,3,4
C1,3,2,4
D1,2,3,4
Attempts:
2 left
💡 Hint
Think about how to avoid downtime by updating secrets and Pods in a controlled sequence.