# Facing connection issue to localhost:8080 while using the CMD kubectl version

**URL:** <https://discuss.kubernetes.io/t/facing-connection-issue-to-localhost-8080-while-using-the-cmd-kubectl-version/22644>\
**Category:** General Discussions\
**Tags:** minikube\
**Created:** [January 10, 2023, 1:03pm UTC](https://discuss.kubernetes.io/t/facing-connection-issue-to-localhost-8080-while-using-the-cmd-kubectl-version/22644 "2023-01-10T13:03:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yash\_Pimple](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/yash_pimple/32/11576_2.png) [@Yash\_Pimple](https://discuss.kubernetes.io/u/Yash_Pimple)\
**Post date:** [January 10, 2023, 1:03pm UTC](https://discuss.kubernetes.io/t/facing-connection-issue-to-localhost-8080-while-using-the-cmd-kubectl-version/22644/1 "2023-01-10T13:03:13Z")

</div>

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

Hello team,

I have installed kubernetes in my mac arm64(m1).  
After installation when i was checking the version with the below command.

`kubectl version`

I am getting the following error

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

then i also tried

```auto
mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

```

but still i am getting the error as follows

`cp: /etc/kubernetes/admin.conf: No such file or directory`

Can anyone please help me with this ?

---

<div class="post-metadata">

**Author:** ![saloni](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@saloni](https://discuss.kubernetes.io/u/saloni)\
**Post date:** [January 10, 2023, 1:23pm UTC](https://discuss.kubernetes.io/t/facing-connection-issue-to-localhost-8080-while-using-the-cmd-kubectl-version/22644/2 "2023-01-10T13:23:34Z")

</div>

The error message `The connection to the server localhost:8080 was refused` suggests that the Kubernetes control plane is not running or not reachable on your local machine.

The error message “cp: /etc/kubernetes/admin.conf: No such file or directory” suggests that there is no admin configuration file present in the directory `/etc/kubernetes/`. This could mean that the kubeadm tool which you used to install Kubernetes on your machine, did not complete the installation successfully.

Can you try these suggestions?

1. Verify that the Kubernetes control plane components (`kube-apiserver`, `kube-controller-manager`, `kube-scheduler`) are running on your machine by running the command `kubectl get pods --all-namespaces`. You should see the control plane pods in the `kube-system` namespace if they are running.
2. Verify that the Kubernetes API server is listening on the correct IP address and port by running the command `kubectl cluster-info`. You should see the correct endpoint for the API server.
3. Verify that the kubeadm was installed properly, by running `kubeadm version`. If you don’t see the version number, it’s possible kubeadm is not installed on your machine.
4. If kubeadm was not installed, you should install it, if it’s installed, try running `kubeadm init` again. This command will initialize the control plane on your machine and create the necessary configuration files.
5. If you are running the Kubernetes cluster on the Apple M1 chip, it’s possible that your version of kubeadm is not compatible with the chip architecture, Try checking the Kubernetes documentation for any known issues or troubleshoot guides related to running on M1.
