[Solved] Pod error: Internal error occurred: unable to upgrade connection: container not found
If you've ever tried to exec into a pod that is still in the process of starting up, you might run into the following error:
error: Internal error occurred: unable to upgrade connection: container not found
This error often occurs because the pod isn't fully running yet. When you try to connect to a container that's still being created or hasn't started properly, Kubernetes can't find the container to establish the connection.
How to fix it: Make sure your pod is in a running state without any errors before attempting to exec into it. You can check the pod's status using:
kubectl get pods
If your pod is still in a Pending
or ContainerCreating
state, it means it's not ready yet for you to execute commands inside it. You should wait until the pod status changes to Running
You can also describe the pod to get more details if there are issues preventing it from running:
kubectl describe pod <pod-name>
This command will show you events and any potential errors that might be causing the delay. Fixing these issues will help get your pod up and running, allowing you to exec into it successfully.