今天在node节点发现不能查看pod了输入命令错误如下
[root@node01 ~]# kubectl get pod
The connection to the server localhost:8080 was refused - did you specify the right host or port?
echo "export KUBECONFIG=/etc/kubernetes/kubelet.conf" >> /etc/profile
然后source /etc/profile
[root@node01 ~]# kubectl get pod
NAME READY STATUS RESTARTS AGE
nginx-deployment-7fd6966748-r82xt 1/1 Running 0 12d
解决。
这里注意/etc/kubernetes/kubelet.conf是你的kubelet的配置文件位置。可能命名不一样需要修改一下。