Bird
0
0

Why does the following command fail? kubectl create secret generic mysecret --from-env-file=env.txt where env.txt contains lines without '=' sign.

medium📝 Troubleshoot Q7 of 15
Kubernetes - Secrets
Why does the following command fail? kubectl create secret generic mysecret --from-env-file=env.txt where env.txt contains lines without '=' sign.
AThe secret name 'mysecret' is reserved
BThe file env.txt must be base64 encoded
CEach line in env.txt must be in key=value format
DThe --from-env-file flag only accepts JSON files
Step-by-Step Solution
Solution:
  1. Step 1: Understand --from-env-file format

    Each line must be key=value to be parsed correctly.
  2. Step 2: Identify the cause of failure

    Lines without '=' cannot be parsed, causing the command to fail.
  3. Final Answer:

    Each line in env.txt must be in key=value format -> Option C
  4. Quick Check:

    Env files require key=value lines [OK]
Quick Trick: Env files must have key=value per line [OK]
Common Mistakes:
  • Using lines without '=' in env files
  • Thinking env files need base64 encoding
  • Assuming secret names cause failure

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes