Recall & Review
beginner
What is a Kubernetes Secret?
A Kubernetes Secret is a way to store and manage sensitive information, like passwords or tokens, separately from application code.
Click to reveal answer
beginner
How do you use a Secret as an environment variable in a Pod?
You define an environment variable in the Pod spec that references the Secret's key using
env: with valueFrom.secretKeyRef.Click to reveal answer
intermediate
Example YAML snippet to set environment variable from Secret key 'password' named 'mysecret'.
env:
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: mysecret
key: passwordClick to reveal answer
beginner
Why should you use Secrets instead of plain environment variables for sensitive data?
Secrets keep sensitive data separate from code and can be encrypted, reducing risk of accidental exposure and improving security.
Click to reveal answer
beginner
What command creates a Secret from literal values?
Use
kubectl create secret generic mysecret --from-literal=password=mypassword to create a Secret named 'mysecret' with a password.Click to reveal answer
How do you reference a Secret key as an environment variable in a Pod spec?
✗ Incorrect
The correct way is to use
valueFrom.secretKeyRef to map a Secret key to an environment variable.Which command creates a Secret from a literal value?
✗ Incorrect
The
kubectl create secret generic command with --from-literal creates a Secret from literal values.Why use Secrets instead of plain environment variables for sensitive data?
✗ Incorrect
Secrets provide encryption and better security for sensitive data compared to plain environment variables.
What is the default encoding for data stored in Kubernetes Secrets?
✗ Incorrect
Kubernetes stores Secret data encoded in Base64 format.
Which Kubernetes object is best for storing sensitive environment variables?
✗ Incorrect
Secrets are designed specifically to store sensitive data like passwords or tokens.
Explain how to use a Kubernetes Secret as an environment variable in a Pod.
Think about how environment variables are set in the Pod YAML.
You got /4 concepts.
Describe why using Secrets is important for managing sensitive data in Kubernetes.
Consider the risks of putting passwords directly in code or config.
You got /4 concepts.