前提条件:之前搭建过k8s集群,使用 kubeadm reset 命令清除集群所有的配置之后,重新运行 kubectl get nodes 时报错:
[root@master ~]# kubectl get nodes
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")
运行kubeadm reset清除配置后,对集群初始化也是成功的
kubeadm init --kubernetes-version=1.26.3 --apiserver-advertise-address=10.0.0.32 --service-cidr=10.2.0.0/16 --pod-network-cidr=10.224.0.0/16
然而当运行 kubectl get nodes 时又报错..
原因:执行 kubeadm reset
命令后没有删除创建的 .kube
目录,重新创建集群就会出现这个问题!
解决:
rm -rf .kube/
sudo mkdir ~/.kube
sudo cp /etc/kubernetes/admin.conf ~/.kube/
cd ~/.kube
sudo mv admin.conf config
sudo service kubelet restart
技术性分享,转载请注明出处!文章来源:https://www.toymoban.com/news/detail-685787.html
欢迎互相交流,共同进步!文章来源地址https://www.toymoban.com/news/detail-685787.html
到了这里,关于解决:Unable to connect to the server: x509: certificate signed by unknown authority (possibly because的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!