Config not found: /etc/kubernetes/admin.conf -- After setting up kubeadm worker node

13,861

TLDR

  1. Run join with sudo
  2. mv /etc/kubernetes/kubelet.conf /etc/kubernetes/admin.conf

After some tinkering, I realized it was a combination of a permissions error and the correct file being generated with an incorrect name.

Instead of running kubeadm join ... naked, running with sudo allowed for the command to create files necessary in /etc/kubernetes

sudo kubeadm join <MASTER_IP:PORT> --token <TOKEN>     --discovery-token-ca-cert-hash <HASH>

However this doesn't generate an admin.conf, but does create a kubelet.conf. I'm unsure why this happens, and couldn't find any documentation on this behavior, however running kubectl with the following parameter solved my issue

kubectl get nodes --kubeconfig /etc/kubernetes/kubelet.conf

Rename kubelet.conf to admin.conf for your convenience at this point.

Share:
13,861
arshbot
Author by

arshbot

Updated on June 18, 2022

Comments

  • arshbot
    arshbot almost 2 years

    Following this tutorial, I set up a worker node for my cluster. However, after running the join command and attempting kubectl get node to verify the node was connected, I am met with the following error

    W0215 17:58:44.648813 3084402 loader.go:223] Config not found: /etc/kubernetes/admin.conf
    The connection to the server localhost:8080 was refused - did you specify the right host or port?
    

    Checking for the existence of admin.conf in /etc/kubernetes/ shows it does not exist. I have ensured that $HOME/.kube/config is also clear. Why is the join command not creating an admin.conf file?