故障排除
问题一:kube-flannel CrashLoopBackOff和OOMkilled异常
现象描述:
kubectl get pod -n kube-system发现网络插件kube-flannel一直在尝试重启,有时能够正常,有时提示CrashLoopBackOff有时OOMKilled。
可能原因:
kube-flannel.yml文件中内存配置的太小。
处理步骤:
问题二:服务器不能直接联网,需要通过代理连接外网的情况下,yum install会一直timeout
现象描述:
yum install 一直提示timeout。
可能原因:
代理通过命令行export http_proxy=xxx等进行配置,yum未能识别代理。
处理步骤:
- 编辑/etc/yum.conf文件,增加代理字段。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
[main] cachedir=/var/cache/yum/$basearch/$releasever keepcache=0 debuglevel=2 logfile=/var/log/yum.log exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 installonly_limit=5 bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum distroverpkg=centos-release sslverify=false http_proxy=http://90.91.4.119:3128 HTTP_PROXY=http://90.91.4.119:3128 https_proxy=http://90.91.4.119:3128 HTTPS_PROXY=http://90.91.4.119:3128 ftp_proxy=http://90.91.4.119:3128 proxy=http://90.91.4.119:3128
- 重新尝试yum install。
问题三:node节点pod无法启动,Status一直处于ContainerCreating
现象描述:
kubectl get pod -o wide发现pod的STATUS一直为ContainerCreating
查看日志可发现:network: failed to set bridge addr: "cni0" already has an IP address different from 10.244.2.1/24
可能原因:
Node之前反复添加过集群。
处理步骤:
- 在Node上执行如下操作。
1 2 3 4 5 6 7 8 9 10 11 12
kubeadm reset systemctl stop kubelet systemctl stop docker rm -rf /var/lib/cni/ rm -rf /var/lib/kubelet/* rm -rf /etc/cni/ ifconfig cni0 down ifconfig flannel.1 down ifconfig docker0 down ip link delete cni0 ip link delete flannel.1 systemctl start docker
- Node上重新运行kubeadm join 加入集群。
- 重新尝试创建pod容器。
