Forum Navigation
You need to log in to create posts and topics.

Error using kubectl (The connection to the server localhost:8080 was refused – did you specify the right host or port?)

User getting the following error while trying to run kubectl commands

kubectl -n kube-system get pods

Error using kubectl (The connection to the server localhost:8080 was refused – did you specify the right host or port?)

The connection to the server localhost:8080 was refused – did you specify the right host or port?

Resolution
The kubernets config file is missing in your home directory. To fix the problem, run these commands

sudo cp /etc/kubernetes/admin.conf ~/.kube/config

sudo chmod 755 ~/.kube/config

sudo chown <your_user_name> ~/.kube/config

sudo chhgrp <your_user_group> ~/.kube/config

If you have found my website, guides, articles or videos useful, please buy me a coffee