liunx系统重启后,k8s报错

报错:

[root@master ~]# kubectl get pod

Unable to connect to the server: dial tcp: lookup localhost on 192.168.8.1:53: no such host

 liunx系统重启后,k8s报错

 

 

原因:k8s在找master节点,查找名字为localhost的master节点,在/etc/hosts中没有找到,找dns。

解决:修改/etc/hosts,在master添加localhost。

后,会报另一个问题:

[root@master ~]# kubectl get pod

The connection to the server localhost:8080 was refused - did you specify the right host or port?

 liunx系统重启后,k8s报错

 

 

解决:修改环境变量,

echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> /etc/profile

上一篇:在POD的ENV中添加POD的信息


下一篇:K8S学习之deployment