8

I configured my config file and when I run :

kubectl get nodes

I have this error :

Unable to connect to the server: x509: certificate signed by unknown authority

I tried all this command but it still change nothing :

kubectl config set-cluster ${KUBE_CONTEXT} --insecure-skip-tls-verify=true \
--server=${KUBE_CONTEXT} 
--insecure-skip-tls-verify=true 

kubectl proxy --address 0.0.0.0 --accept-hosts '.*'
1
  • Its your local env or Cloud? Are you using kubeadm, minikube, etc? What K8s version are you using?
    – PjoterS
    Commented Aug 11, 2020 at 10:31

1 Answer 1

9

The error indicates a possible certificate mismatch.

Verify that the $HOME/.kube/config file contains a valid certificate, and regenerate a certificate if necessary.

Unset the KUBECONFIG environment variable using:

unset KUBECONFIG

Or set it to the default KUBECONFIG location:

export KUBECONFIG=/etc/kubernetes/admin.conf

Another workaround is to overwrite the existing kubeconfig for the "admin" user

mv  $HOME/.kube $HOME/.kube.bak
mkdir $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

Refer Link

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.