kubernetes 常见错误

  • 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

    相关文章