---
title: Troubleshooting kubectl connection refused
slug: install-10x/troubleshooting-kubectl-connection-refused
docTags: 
createdAt: 2025-12-09T12:24:20.578Z
---

This document describes steps to troubleshoot kubectl error:

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

Troubleshooting steps below:

1. The kubectl should be executed on the Master Node.
2. The current user must have Kubernetes cluster configuration environment variable or the kube config file:

:::BlockQuote{indent="1"}
$ env | grep -i kube
KUBECONFIG=/etc/kubernetes/admin.conf


$ ls \~/.kube/config
config
:::

:::Paragraph{indent="1"}
Solution:
:::

:::BlockQuote{indent="1"}
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

export KUBECONFIG=$HOME/.kube/config
echo 'export KUBECONFIG=$HOME/.kube/config' >> $HOME/.bashrc

\# try your get pods command now

kubectl get pods

\# further troubleshooting
\## Minimum verbosity
kubectl get pods --v=0

\## Debug level verbosity
kubectl get pods --v=4

\## Maximum verbosity
kubectl get pods --v=9
:::

3. The containerd service must be running:

:::BlockQuote{indent="1"}
systemctl status containerd
:::

4. The kubelet service must be running:

:::BlockQuote{indent="1"}
systemctl status kubelet
:::

5. TCP port 6443 should be listed as the listening port:

:::BlockQuote{indent="1"}
netstat -pnlt | grep 6443

tcp6       0      0 \:::6443    \:::\*      LISTEN      2785/kube-apiserver&#x20;
:::

6. If TCP port 6443 is not available, check kubelet logs:

:::BlockQuote{indent="1"}
journalctl -xeu kubelet
:::

7. Verify k8s certificates have not expired. If expired, then follow How to renew certificates on Kubernetes

:::BlockQuote{indent="1"}
kubeadm alpha certs check-expiration
:::

8. Open a new support ticket for further troubleshooting


