部署k8s v1.21.5版本第二个master节点过程中,kubectl get node 提示如下报错

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@k8s-master02 kubernetes]# kubectl get node 
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@k8s-master02 kubernetes]# 

确认是环境没有配置

mkdir -p $HOME/.kube 

sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config 

sudo chown $(id -u):$(id -g) $HOME/.kube/config

[root@k8s-master02 ~]# mkdir -p $HOME/.kube  
[root@k8s-master02 ~]# sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config 
cp: overwrite ‘/root/.kube/config’? yes
[root@k8s-master02 ~]# sudo chown $(id -u):$(id -g) $HOME/.kube/config
[root@k8s-master02 ~]#
[root@k8s-master02 ~]# kubectl get node 
NAME           STATUS   ROLES                  AGE   VERSION
k8s-master01   Ready    control-plane,master   44d   v1.21.5
k8s-master02   Ready    control-plane,master   44d   v1.21.5
k8s-node01     Ready    <none>                 44d   v1.21.5
[root@k8s-master02 ~]# 
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐