Unable to connect to the server

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!

Try to see what this output shows

microk8s status

My hunch is that its not yet up.

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

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

Yes, unfortunately still same error

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.

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".

1 Like

Worked like a charm! Thank you very much.

1 Like