kubernetes 常見錯誤

  1. 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@ubuntu:~# 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@ubuntu:~# rm -rf $HOME/.kube
root@ubuntu:~# mkdir -p $HOME/.kube
root@ubuntu:~# sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
root@ubuntu:~# sudo chown $(id -u):$(id -g) $HOME/.kube/config
root@ubuntu:~# kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 9m30s

先刪除 $HOME/.kube

  1. node NotReady

root@ubuntu:~# kubectl get node
NAME STATUS ROLES AGE VERSION
ubuntu NotReady master 12m v1.17.3

因爲沒有創建flannel網絡

root@ubuntu:~# kubectl create -f kube-flannel.yml
podsecuritypolicy.policy/psp.flannel.unprivileged created
clusterrole.rbac.authorization.k8s.io/flannel created
clusterrolebinding.rbac.authorization.k8s.io/flannel created
serviceaccount/flannel created
configmap/kube-flannel-cfg created
daemonset.apps/kube-flannel-ds-amd64 created
daemonset.apps/kube-flannel-ds-arm64 created
daemonset.apps/kube-flannel-ds-arm created
daemonset.apps/kube-flannel-ds-ppc64le created
daemonset.apps/kube-flannel-ds-s390x created
root@ubuntu:~# kubectl get node
NAME STATUS ROLES AGE VERSION
ubuntu NotReady master 14m v1.17.3

等待 網絡創建完成

root@ubuntu:~# kubectl get node
NAME STATUS ROLES AGE VERSION
ubuntu Ready master 15m v1.17.3

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章