Bird
0
0

You run kubectl create secret generic mysecret --from-literal=key1=value1 --from-literal=key2 and get an error. What is the problem?

medium📝 Troubleshoot Q6 of 15
Kubernetes - Secrets
You run kubectl create secret generic mysecret --from-literal=key1=value1 --from-literal=key2 and get an error. What is the problem?
AThe key 'key1' cannot contain numbers
BUsing multiple --from-literal flags is not allowed
CThe secret name 'mysecret' is invalid
DMissing value for key2 in --from-literal flag
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax of --from-literal flags

    Each --from-literal must have a key=value pair. Missing value causes error.
  2. Step 2: Identify the error in the command

    --from-literal=key2 lacks '=value', so it is invalid.
  3. Final Answer:

    Missing value for key2 in --from-literal flag -> Option D
  4. Quick Check:

    --from-literal requires key=value format [OK]
Quick Trick: Always use key=value with --from-literal [OK]
Common Mistakes:
  • Omitting value after '='
  • Thinking multiple --from-literal flags are disallowed
  • Assuming secret names restrict numbers

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes