学习来源: 51cto: https://edu.51cto.com/sd/518e5
腾讯课堂: https://ke.qq.com/course/2738602
K8s集群环境搭建:https://blog.csdn.net/qq_26900081/article/details/109291999
学习过程中一不小心把K8s给折腾坏了,重新初始化一下群里,一顿操作猛如虎,万幸恢复如初了。
master1上的命令kubectl都执行不了,众node上docker ps发现都容器全部不在了。
vi /var/log/messages 错误信息: K8s node "localhost.master1.131" not found
1、所有节点(master和node)重置:kubeadm reset
2、我修改了配置文件(所有master节点),所以重新配置一下: kubeadm config images pull --config ./kubeadm-config.yaml
3、初始化(master1主节点):kubeadm init --config kubeadm-config.yaml --upload-certs
4、将master2、master3和所有node节点加入集群:参考 https://blog.csdn.net/qq_26900081/article/details/109331192
5、执行以下命令解决错误,需要重新配置这个目录.kube和文件:
错误信息:Unable to connect to the server: x509: certificate signed by unknown authority (possibly because of "crypto/rsa: verification error" while trying to verify candidate authority certificate "kubernetes")
[root@localhost ~]# rm -rf $HOME/.kube
[root@localhost ~]# mkdir -p $HOME/.kube
[root@localhost ~]# sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
[root@localhost ~]# sudo chown $(id -u):$(id -g) $HOME/.kube/config
6、重新安装Calico:参考https://blog.csdn.net/qq_26900081/article/details/109331192第四节
7、按需重新安装Metrics和Dashboard、kuboard:参考https://blog.csdn.net/qq_26900081/article/details/109337475