Bird
0
0

What will be the output of the command kubectl get secret mysecret -o yaml after creating a secret with kubectl create secret generic mysecret --from-literal=password=pass123?

medium📝 Command Output Q13 of 15
Kubernetes - Secrets
What will be the output of the command kubectl get secret mysecret -o yaml after creating a secret with kubectl create secret generic mysecret --from-literal=password=pass123?
AThe secret will not appear in the output
BThe password will be shown in plain text under data field
CThe password will be base64 encoded under data field
DAn error will occur because secrets cannot be viewed
Step-by-Step Solution
Solution:
  1. Step 1: Understand how Kubernetes stores secret data

    Kubernetes stores secret values base64 encoded in the data field when viewed in YAML or JSON.
  2. Step 2: Analyze the command output

    The command shows the secret in YAML format with the password base64 encoded, not plain text.
  3. Final Answer:

    The password will be base64 encoded under data field -> Option C
  4. Quick Check:

    Secrets data is base64 encoded = A [OK]
Quick Trick: Secrets data shown base64 encoded, not plain text [OK]
Common Mistakes:
  • Expecting plain text output
  • Thinking secrets are hidden completely
  • Assuming error when viewing secrets

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes