Bird
0
0

You execute kubectl exec mypod -- ls /var/log and receive the error error: unable to upgrade connection: container not found. What is the most probable reason?

medium📝 Troubleshoot Q6 of 15
Kubernetes - Pods
You execute kubectl exec mypod -- ls /var/log and receive the error error: unable to upgrade connection: container not found. What is the most probable reason?
AThe Pod has multiple containers and no container was specified
BThe Pod does not exist in the cluster
CThe command <code>ls</code> is not installed in the container
DThe Kubernetes API server is down
Step-by-Step Solution
Solution:
  1. Step 1: Analyze error message

    The error indicates the container was not found.
  2. Step 2: Consider Pod container count

    If the Pod has multiple containers, you must specify which container to exec into using -c flag.
  3. Step 3: Other options

    Pod existence or API server issues would cause different errors; missing ls would cause command not found inside container, not container not found.
  4. Final Answer:

    The Pod has multiple containers and no container was specified -> Option A
  5. Quick Check:

    Multiple containers require -c flag? Yes. [OK]
Quick Trick: Use -c for multi-container Pods [OK]
Common Mistakes:
  • Ignoring the need to specify container
  • Assuming Pod does not exist

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes