Bird
0
0

You want to create a secret from a file named config.txt and also add a literal key env=prod. Which command correctly does this?

hard📝 Best Practice Q15 of 15
Kubernetes - Secrets
You want to create a secret from a file named config.txt and also add a literal key env=prod. Which command correctly does this?
Akubectl create secret generic appsecret --from-file=config.txt env=prod
Bkubectl create secret generic appsecret --from-file=config.txt --from-literal=env=prod
Ckubectl create secret generic appsecret --from-literal=config.txt --from-literal=env=prod
Dkubectl create secret generic appsecret --from-file=config.txt --literal=env=prod
Step-by-Step Solution
Solution:
  1. Step 1: Understand how to add file and literal to secret

    Use --from-file=filename to add file content and --from-literal=key=value for literals.
  2. Step 2: Check options for correct syntax

    kubectl create secret generic appsecret --from-file=config.txt --from-literal=env=prod correctly uses both flags with proper syntax; others misuse flags or omit '='.
  3. Final Answer:

    kubectl create secret generic appsecret --from-file=config.txt --from-literal=env=prod -> Option B
  4. Quick Check:

    Use --from-file and --from-literal together correctly = C [OK]
Quick Trick: Combine --from-file and --from-literal with '=' correctly [OK]
Common Mistakes:
  • Using --from-literal for file instead of --from-file
  • Omitting '=' in --from-literal
  • Mixing flags incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes