kubectl get nodes时,Unable to connect to the server: x509: certificate signed by unknown authority
使用kubeadm reset之后,重新初始化之后,使用kubectl get pods命令时,出现:[***@k8s-master-*** ***]$ kubectl get podsUnable to connect to the server: x509: certificate signed by unknown authority (possibly because of "crypto
·
使用kubeadm reset之后,重新初始化之后,使用kubectl get pods命令时,出现:
[***@k8s-master-*** ***]$ kubectl get pods
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 init --kubernetes-version=v1.11.0 --apiserver-advertise-address=... 命令创建集群。提示执行以下几个命令:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
查看发现,kubeadm reset时没有删除.kube目录下的文件,这里手动删除,然后再按上述步骤执行一遍,即可解决问题。
如下:
[***@k8s-master-*** ~]$ rm -rf .kube
[***@k8s-master-*** ~]$ mkdir -p .kube
[***@k8s-master-*** .kube]$ cd .kube
[***@k8s-master-*** .kube]$ sudo cp /etc/kubernetes/admin.conf config
[***@k8s-master-*** .kube]$ sudo chown $(id -u):$(id -g) config
[***@k8s-master-*** ~]$ kubectl get pods
No resources found.
[***@k8s-master-*** ~]$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-master-*** NotReady master 1d v1.11.0
现在就可以将从节点加入集群了
更多推荐
已为社区贡献6条内容
所有评论(0)