Bird
0
0

You run kubectl create configmap test-config --from-file=config.txt but get an error saying the file does not exist. What is the most likely cause?

medium📝 Troubleshoot Q14 of 15
Kubernetes - ConfigMaps
You run kubectl create configmap test-config --from-file=config.txt but get an error saying the file does not exist. What is the most likely cause?
AThe ConfigMap name is invalid
BThe file <code>config.txt</code> is not in the current directory
CYou need to use <code>--from-env-file</code> instead
Dkubectl command does not support --from-file
Step-by-Step Solution
Solution:
  1. Step 1: Check file existence requirement

    The --from-file flag requires the file to exist in the current directory or given path.
  2. Step 2: Identify cause of error

    If the file is missing or path is wrong, kubectl will error that the file does not exist.
  3. Final Answer:

    The file config.txt is not in the current directory -> Option B
  4. Quick Check:

    File must exist where command runs [OK]
Quick Trick: Check file path and existence before creating ConfigMap [OK]
Common Mistakes:
  • Assuming ConfigMap name causes file error
  • Using wrong flag instead of --from-file
  • Ignoring file location or path

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes