# Unable to connect to the server

**URL:** <https://discuss.kubernetes.io/t/unable-to-connect-to-the-server/18104>\
**Category:** microk8s\
**Created:** [November 16, 2021, 9:30am UTC](https://discuss.kubernetes.io/t/unable-to-connect-to-the-server/18104 "2021-11-16T09:30:13Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![yattax](https://avatars.discourse-cdn.com/v4/letter/y/ac8455/32.png) [@yattax](https://discuss.kubernetes.io/u/yattax)\
**Post date:** [November 16, 2021, 9:30am UTC](https://discuss.kubernetes.io/t/unable-to-connect-to-the-server/18104/1 "2021-11-16T09:30:13Z")

</div>

Hi,  
I’m using Windows 10 Enterprise and I just installed Microk8s. It seems installation completed without any error. But if I want to check K8S status like below, it gives error;

> C:\Windows\system32\>microk8s kubectl get all --all-namespaces  
> Unable to connect to the server: dial tcp 10.0.2.15:16443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

Any idea how can I solve this?

Thanks!

---

<div class="post-metadata">

**Author:** ![balchua1](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/balchua1/32/5372_2.png) [@balchua1](https://discuss.kubernetes.io/u/balchua1)\
**Post date:** [November 16, 2021, 11:06am UTC](https://discuss.kubernetes.io/t/unable-to-connect-to-the-server/18104/2 "2021-11-16T11:06:06Z")

</div>

Try to see what this output shows

```auto
microk8s status

```

My hunch is that its not yet up.

---

<div class="post-metadata">

**Author:** ![yattax](https://avatars.discourse-cdn.com/v4/letter/y/ac8455/32.png) [@yattax](https://discuss.kubernetes.io/u/yattax)\
**Post date:** [November 16, 2021, 11:47am UTC](https://discuss.kubernetes.io/t/unable-to-connect-to-the-server/18104/3 "2021-11-16T11:47:25Z")

</div>

Hi @balchua1 ,  
output is below;

> C:\Windows\system32\>microk8s status  
> microk8s is running  
> high-availability: no  
> datastore master nodes: 127.0.0.1:19001  
> datastore standby nodes: none  
> addons:  
> enabled:  
> ha-cluster # Configure high availability on the current node  
> disabled:  
> ambassador # Ambassador API Gateway and Ingress  
> cilium # SDN, fast with full network policy  
> dashboard # The Kubernetes dashboard  
> dns # CoreDNS  
> fluentd # Elasticsearch-Fluentd-Kibana logging and monitoring  
> gpu # Automatic enablement of Nvidia CUDA  
> helm # Helm 2 - the package manager for Kubernetes  
> helm3 # Helm 3 - Kubernetes package manager  
> host-access # Allow Pods connecting to Host services smoothly  
> ingress # Ingress controller for external access  
> istio # Core Istio service mesh services  
> jaeger # Kubernetes Jaeger operator with its simple config  
> kata # Kata Containers is a secure runtime with lightweight VMS  
> keda # Kubernetes-based Event Driven Autoscaling  
> knative # The Knative framework on Kubernetes.  
> kubeflow # Kubeflow for easy ML deployments  
> linkerd # Linkerd is a service mesh for Kubernetes and other frameworks  
> metallb # Loadbalancer for your Kubernetes cluster  
> metrics-server # K8s Metrics Server for API access to service metrics  
> multus # Multus CNI enables attaching multiple network interfaces to pods  
> openebs # OpenEBS is the open-source storage solution for Kubernetes  
> openfaas # openfaas serverless framework  
> portainer # Portainer UI for your Kubernetes cluster  
> prometheus # Prometheus operator for monitoring and logging  
> rbac # Role-Based Access Control for authorisation  
> registry # Private image registry exposed on localhost:32000  
> storage # Storage class; allocates storage from host directory  
> traefik # traefik Ingress controller for external access

---

<div class="post-metadata">

**Author:** ![balchua1](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/balchua1/32/5372_2.png) [@balchua1](https://discuss.kubernetes.io/u/balchua1)\
**Post date:** [November 16, 2021, 12:11pm UTC](https://discuss.kubernetes.io/t/unable-to-connect-to-the-server/18104/4 "2021-11-16T12:11:09Z")

</div>

Looks good to me. Running the command `microk8s get no` is still failing?

---

<div class="post-metadata">

**Author:** ![yattax](https://avatars.discourse-cdn.com/v4/letter/y/ac8455/32.png) [@yattax](https://discuss.kubernetes.io/u/yattax)\
**Post date:** [November 16, 2021, 1:05pm UTC](https://discuss.kubernetes.io/t/unable-to-connect-to-the-server/18104/5 "2021-11-16T13:05:23Z")

</div>

Yes, unfortunately still same error

---

<div class="post-metadata">

**Author:** ![amc](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/amc/32/15696_2.png) [@amc](https://discuss.kubernetes.io/u/amc)\
**Post date:** [December 30, 2022, 9:57pm UTC](https://discuss.kubernetes.io/t/unable-to-connect-to-the-server/18104/6 "2022-12-30T21:57:31Z")

</div>

I am encountering the exact same error. Windows 11 Pro. If I sign into the VM and run `sudo microk8s.kubectl` everything works as expected. This happens after a Windows forced restart (I really do hate Windows). The only solution that I have yet found is to uninstall than reinstall Microk8s.

---

<div class="post-metadata">

**Author:** ![amc](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/amc/32/15696_2.png) [@amc](https://discuss.kubernetes.io/u/amc)\
**Post date:** [December 31, 2022, 4:12am UTC](https://discuss.kubernetes.io/t/unable-to-connect-to-the-server/18104/7 "2022-12-31T04:12:44Z")

</div>

I see what it is.

When I run the `microk8s kubectl config view --raw` in Windows, the IP address is wrong. For example, in my case, the config shows `https://172.26.23.109:16443`. But when I run `multipass info --all` the correct IP is `172.26.208.178`. The correct IP is shown after running `microk8s config`, though, so it appears that Microk8s is failing to update its kubectl config.

I was able to fix it with `microk8s kubectl config set-cluster microk8s-cluster --server="https://172.26.208.178:16443"`.

---

<div class="post-metadata">

**Author:** ![chrysanthos](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/chrysanthos/32/12180_2.png) [@chrysanthos](https://discuss.kubernetes.io/u/chrysanthos)\
**Post date:** [April 3, 2023, 7:23am UTC](https://discuss.kubernetes.io/t/unable-to-connect-to-the-server/18104/8 "2023-04-03T07:23:36Z")

</div>

Worked like a charm! Thank you very much.
