Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 385
arshbot Avatar asked Dec 17 '25 08:12

arshbot


1 Answers

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.

like image 61
arshbot Avatar answered Dec 20 '25 12:12

arshbot



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!