<p>I have a problem with kubernetes local cluster recently.When I was using the command <code>kubectl exec -it curl-- bash</code> to run some commands on the pod called 'curl',I got some errors:
<a href="https://i.stack.imgur.com/WQir6.png" rel="nofollow noreferrer">error info</a></p>
<p>And here are the nodes' info:
<a href="https://i.stack.imgur.com/yvO7A.png" rel="nofollow noreferrer">nodes info</a></p>
<p>The pod 'curl' is working nicely on the datanode-2 and kubelet is listening on the port 10250,but I don't know why I got the error info,Here is the `kubectl describe po curl':
<a href="https://i.stack.imgur.com/N8Myo.png" rel="nofollow noreferrer">curl pod describe</a></p>
<p>And here are the pods in the namespace kube-system,the CNI is flannel:
<a href="https://i.stack.imgur.com/4bzPf.png" rel="nofollow noreferrer">enter image description here</a></p>
<p>It's same to run <code>kubectl exec</code> on others pod(same on datanode-1),how to solve this?</p>

Jesse Stutler
<p>This error might be related with communication of the kube-apiserver.service (on the control nodes)   with the kubelet.service (port 10250 by default)</p>
<p>To Troubleshoot , you might want to ssh into the control node and</p>
<pre><code>telnet hostname(workernode) 10250
telnet privateip(workernode) 1025
</code></pre>
<p>If both telnet tests failed it might be related with your firewall on the worker nodes . So you should open the port 10250 in the worker nodes . To check if the kubelet is running on this port</p>
<pre><code>lsof -i :10250
</code></pre>
<p>If the telnet test fails with the hostname or public ip, but works with the private ip . You should add to the unit service file of the kube-apiserver (located at /etc/systemd/system/kube-apiserver.service) the flag</p>
<pre><code>--kubelet-preferred-address-types InternalIP
</code></pre>
<p>Save it , and then just</p>
<pre><code>systemctl daemon-reload
systemctl restart kube-apiserver 
</code></pre>
