0x00 Problem
在使用二進制搭建 k8s 集群的過程中,使用 kubectl get
等操作時始終顯示 x509: certificate signed by unknown authority
:
[root@k8sm90 ~]# kubectl get cs,nodes
Unable to connect to the server: x509: certificate signed by unknown authority
以至於后面的一些操作也無法繼續。
0x01 Solution
可能出現這個問題的情況都不同,但是吾這里排查到的是由於之前使用 kubuadm
的方式在本機創建過 k8s ,發現 ~/.kube/config
文件還存在,刪除了此文件之后,便沒有報錯了
[root@k8sm90 ~]# rm -rf /root/.kube/config
[root@k8sm90 ~]# kubectl get cs,nodes
NAME AGE
componentstatus/scheduler <unknown>
componentstatus/controller-manager <unknown>
componentstatus/etcd-0 <unknown>
componentstatus/etcd-1 <unknown>
componentstatus/etcd-2 <unknown>
NAME STATUS ROLES AGE VERSION
192.168.1.90 Ready master 5h43m v1.16.2
192.168.1.91 Ready node 5h30m v1.16.2
192.168.1.92 Ready node 5h29m v1.16.2