k8s执⾏kubectl相关命令报错:Unabletoconnecttotheserver。。。
⼀、执⾏kubectl报错
-rw------- 1 root root 5432 1⽉411:f
[root@localhost kubernetes]# 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") [root@localhost kubernetes]# kubectl get svc
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 kubernetes]# mkdir -p $HOME/.kube
[root@localhost kubernetes]# cp -i /etc/f $HOME/.kube/config
cp:是否覆盖"/root/.kube/config"? y
[root@localhost kubernetes]# chown $(id -u):$(id -g) $HOME/.kube/config
三、测试解决问题
unable[root@localhost kubernetes]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
localhost Ready master 9h v1.18.5
redis-01.hlqxt Ready <none> 4h51m v1.18.5
redis-02.hlqxt Ready <none> 4h4m v1.18.5
redis-03.hlqxt Ready <none> 4h4m v1.18.5
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论