项目场景:

K8s搭建


问题描述:

查看pods状态,发现 calico-node异常
[root@k8s-master ~]# kubectl get pods --all-namespaces
NAMESPACE              NAME                                         READY   STATUS    RESTARTS   AGE
kube-system            calico-node-m5s7m                            0/1     Running   0          25s
kube-system            calico-node-s959x                            0/1     Running   0          12s

查看日志提示 :

listen tcp: lookup localhost on 8.8.4.4:53: no such host

原因分析:

localhost未设置映射


解决方案:

添加localhost映射:vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

删除calico-node,重启 :kubectl delete pod calico-node-实际名称 -n kube-system
查看 :kubectl get pods --all-namespaces -o wide

[root@k8s-master ~]# kubectl get pods --all-namespaces -o wide
NAMESPACE              NAME                                         READY   STATUS    RESTARTS   AGE   IP               NODE         NOMINATED NODE   READINESS GATES
kube-system            calico-node-bs8tr                            1/1     Running   0          35m   192.168.200.16   k8s-master   <none>           <none>
kube-system            calico-node-wltbq                            1/1     Running   0          34m   192.168.200.17   k8s-worker   <none>           <none>
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐