一、pod查看日志server misbehaving
问题:
Get https://k8s-node6:10250/containerLogs/default/xxxxx-5b65979f96-7q7c7/xxxx?follow=true: dial tcp: lookup k8s-node6 on 172.18.0.1:53: server misbehaving
[root@k8s-master1 ~]# kubectl logs -f jic-open-api-center-5b65979f96-7q7c7
Error from server: Get https://k8s-node6:10250/containerLogs/default/jic-open-api-center-5b65979f96-7q7c7/jic-open-api-center?follow=true: dial tcp: lookup k8s-node6 on 172.18.0.1:53: server misbehaving
解决:
- 怀疑DNS的问题
- 在集群所有服务器修改 /etc/hosts,缺失的进行完善
[root@wfwtest1 ~]# vi /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 172.18.0.108 k8s-master1 172.18.0.120 k8s-node1 172.18.0.121 k8s-node2 172.18.0.206 k8s-node3 172.18.0.207 k8s-node4 172.18.0.11 k8s-node5 172.18.1.32 k8s-node6 172.18.1.33 k8s-node7
- 问题解决
二、启动Pod网络报错
问题:
networkPlugin cni failed to set up pod network: failed to set bridge addr: “cni0” already has an IP address different from 10.244.8.1/24
Warning FailedCreatePodSandBox 21m kubelet, k8s-node6 Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "40543d3f5cc9b01ff89b367aa7faad0c88eac617bdef214fbcae5a1d7e4d103d" network for pod "jic-open-api-center-5b65979f96-gglfr": networkPlugin cni failed to set up pod "jic-open-api-center-5b65979f96-gglfr_default" network: failed to set bridge addr: "cni0" already has an IP address different from 10.244.8.1/24
解决:
- "cni0"的ip跟10.244.8.1/24不同
- 查看k8s-node6的ip
[root@wfwtest1 ~]# ifconfig
flannel.1的IP为10.244.9.0,查看cat /run/flannel/subnet.env
发现cni0不一致
3. 修改cni0的IP段
- 方法1是将cni0的IP段修改为10.244.9.1。
- 方法2是将这个错误的网卡删除掉,然后自动重建。
[root@wfwtest1 ~]# ifconfig cni0 down [root@wfwtest1 ~]# ip link delete cni0