<p>My goal is to list environment variables in my wordpress pod</p>

<pre><code>kubectl get pods

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

<p>Although the pod is running</p>

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

<p>If I try the other one</p>

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

<p>My services</p>

<pre><code>wordpress                NodePort       10.102.29.45     &lt;none&gt;        80:31262/TCP     94d
wordpress-mysql          ClusterIP      None             &lt;none&gt;        3306/TCP         94d
</code></pre>

<p>Why is container not found?</p>

Richard Rublev
<p>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</p>

<p><code>kubectl logs {{podname}}</code>: for pod logs</p>

<p><code>kubectl describe pod {{podname}}</code> for detailed description. </p>

<p>As suggested by @mdaniel in comment check for ports also.</p>

<p>Are you able to access application on nodePort? </p>
