Forum archive › Kubernetes & Helm Charts
ArchiveError 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 commandssudo 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
Fastest way to resolve the error
The connection to the server 10.100.90.83:6443 was refused – did you specify the right host or port?
After reboot of your server
containerd config default | tee /etc/containerd/config.toml
sed -i 's/SystemdCgroup = false/SystemdCgroup = true/g' /etc/containerd/config.toml systemctl restart containerd systemctl restart docker systemctl restart kubelet
Attachments: commands.txt commands.txt
We do this for a living.
Kubernetes, DevOps and platform engineering, delivered in days — not another weekend lost to a stack trace.
Start a project →