Welcome to the Linux Foundation Forum!

couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp 12

I'm getting this error on the worker node. I initially thought that all kubectl commands need to go through the control plane master node (it's working as expected there). But on the worker node, kubectl commands give this output. Is this expected? I ran the k8sWorker.sh script on the worker node. It didn't give any error. I even did the kubeadm join command to make the worker node join the master node in the cluster. On doing kubectl get nodes, I can see both master and worker nodes in Ready State.

Best Answers

  • shubham.sudame
    shubham.sudame Posts: 2
    Answer ✓

    FYI - kubectl commands work just fine on the master node. I get the error only on the worker node.

  • fazlur.khan
    fazlur.khan Posts: 52
    Answer ✓

    @shubham.sudame

    Kubectl - utility needs a config file which contains your server endpoint, CA details, user credentials to authenticate. This config file is located under** home dir/.kube/config **

    This file is available in your master node, as a reason you are able to access the cluster from the master node.

    whereas, its not copied/available on worker node hence the error.

Answers

  • ok so this means we need to copy or just the cp to access the cluster ?

  • chrispokorni
    chrispokorni Posts: 2,301

    Hi @alexmondaini,

    The lab setup assumes cluster is accessed from a single kubectl client, that is the one from the control plane node. Kubectl requires the API server endpoint and credentials to access the cluster, stored on the control plane node in the $HOME/.kube/config file.

    Although not recommended, if desired, the config file can be copied over to the worker/secondary node to access the cluster from there as well.

    Regards,
    -Chris

Categories

Upcoming Training