Bird
0
0

Which YAML snippet correctly defines a Kubernetes Secret using the stringData field with plain text?

easy📝 Syntax Q3 of 15
Kubernetes - Secrets
Which YAML snippet correctly defines a Kubernetes Secret using the stringData field with plain text?
AapiVersion: v1\nkind: Secret\ndata:\n password: cGFzc3dvcmQ=\ntype: Opaque
BapiVersion: v1\nkind: Secret\ndata:\n password: password\ntype: Opaque
CapiVersion: v1\nkind: Secret\nstringData:\n password: cGFzc3dvcmQ=\ntype: Opaque
DapiVersion: v1\nkind: Secret\nstringData:\n password: password\ntype: Opaque
Step-by-Step Solution
Solution:
  1. Step 1: Understand Secret data fields

    Secrets can use 'data' (base64 encoded) or 'stringData' (plain text) fields.
  2. Step 2: Identify correct syntax for unencrypted Secret

    'stringData' allows plain text input which Kubernetes encodes automatically.
  3. Final Answer:

    YAML with stringData and plain text password -> Option D
  4. Quick Check:

    Unencrypted Secret YAML uses stringData with plain text [OK]
Quick Trick: Use stringData for plain text Secret input [OK]
Common Mistakes:
  • Putting plain text in 'data' field without base64
  • Confusing base64 encoded and plain text fields
  • Using wrong apiVersion or kind

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes