sslkuberneteskubectl

kubectl unable to connect to server: x509: certificate signed by unknown authority


i'm getting an error when running kubectl one one machine (windows)

the k8s cluster is running on CentOs 7 kubernetes cluster 1.7 master, worker

Here's my .kube\config

  
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: REDACTED
    server: https://10.10.12.7:6443
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    user: system:node:localhost.localdomain
  name: system:node:localhost.localdomain@kubernetes
current-context: system:node:localhost.localdomain@kubernetes
kind: Config
preferences: {}
users:
- name: system:node:localhost.localdomain
  user:
    client-certificate-data: REDACTED
    client-key-data: REDACTED
  

the cluster is built using kubeadm with the default certificates on the pki directory

kubectl unable to connect to server: x509: certificate signed by unknown authority


Solution

  • Sorry I wasn't able to provide this earlier, I just realized the cause:

    So on the master node we're running a kubectl proxy

    kubectl proxy --address 0.0.0.0 --accept-hosts '.*'
    

    I stopped this and voila the error was gone.

    I'm now able to do

        kubectl get nodes
    NAME                    STATUS    AGE       VERSION
    centos-k8s2             Ready     3d        v1.7.5
    localhost.localdomain   Ready     3d        v1.7.5
    

    I hope this helps those who stumbled upon this scenario.