一.集群部署步骤操作:
详细查看【许大仙】整理的命令合集,地址:https://www.yuque.com/fairy-era/yg511q/hg3u04
二.部署过程中常见问题
1.kubeadm init ............出现下图:
这是由于云网络类型导致,感兴趣可以详细查看一下!
解决:
kubeadm init...当检测到有 etcd.yaml 生成时,立即在另一个窗口编辑修改,命令:
vim /etc/kubernetes/manifests/etcd.yaml
修改文件中下面三行如下:
# 也就是将多余的公网ip删除,将公网ip改为127
- --listen-client-urls=https://127.0.0.1:2379
- --listen-metrics-urls=http://127.0.0.1:2381
- --listen-peer-urls=https://127.0.0.1:2380
解决思路可以查看这位大佬:https://blog.csdn.net/rdj1314/article/details/119803703
2.coreDns状态CrashLoopBackOff问题解决
解决方式:https://www.yoyoask.com/?p=2209
3.coredns对应的pod状态为ContainerCreating
网上搜索一圈无效后又研究了下kubeadm reset命令执行后的输出结果:
The reset process does not clean CNI configuration. To do so, you must remove /etc/cni/net.d
The reset process does not reset or clean up iptables rules or IPVS tables.
If you wish to reset iptables, you must do so manually by using the "iptables" command.
If your cluster was setup to utilize IPVS, run ipvsadm --clear (or similar)
to reset your system's IPVS tables.
The reset process does not clean your kubeconfig files and you must remove them manually.
Please, check the contents of the $HOME/.kube/config file.
然后根据上面的提示把/etc/cni/net.d目录删掉,然后重新执行kubeadm init命令就可以了
解决方式:
先执行命令:rm -rf /etc/cni/net.d
再执行kubeadm init xxxxxxx
可以查看地址:https://blog.csdn.net/john1337/article/details/109352414
3.failed to set bridge addr: "cni0" already has an IP address different from 10.244.1.1/24
解决方法:
将这个错误的网卡删掉,它会自己重建,这里采用删除重生的方法,首先停用网络,然后删除配置,命令如下:
-
ifconfig cni0 down
-
ip link delete cni0详细查看:https://blog.csdn.net/Wuli_SmBug/article/details/104712653