Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: unable to upgrade connection: container not found ("wordpress")

My goal is to list environment variables in my wordpress pod

kubectl get pods

wordpress-77f45f895-lxh5t            1/1     Running            993        92d
wordpress-mysql-7d4fc77fdc-x4bfm     1/1     Running            87         92d

Although the pod is running

kubectl exec wordpress-77f45f895-lxh5t env
error: unable to upgrade connection: container not found ("wordpress")

If I try the other one

kubectl exec wordpress-mysql-7d4fc77fdc-x4bfm env
Unable to connect to the server: net/http: TLS handshake timeout

My services

wordpress                NodePort       10.102.29.45     <none>        80:31262/TCP     94d
wordpress-mysql          ClusterIP      None             <none>        3306/TCP         94d

Why is container not found?

like image 337
Richard Rublev Avatar asked Jun 14 '19 02:06

Richard Rublev


2 Answers

by looking at your output, I think your containers are crashing. first pod crashed 993 times and the second one crashed 87 times. You can check logs of the containers/events of the pods

kubectl logs {{podname}}: for pod logs

kubectl describe pod {{podname}} for detailed description.

As suggested by @mdaniel in comment check for ports also.

Are you able to access application on nodePort?

like image 166
Guru Avatar answered Oct 18 '22 18:10

Guru


The problem may be that the container hasn't been started yet. Use

kubectl describe pod <podname>

to see if you can view a message such as:

Normal  Created                 19s   kubelet                  Created container container

Normal  Started                 17s   kubelet                  Started container container

The container will have been created and you should no longer see that error message.

like image 1
b. schroeder Avatar answered Oct 18 '22 19:10

b. schroeder