hejkerooo
hejkerooo

Reputation: 787

microk8s Connection to port 16443 was refused

I'm getting following error message:

root@master-1:~# microk8s.kubectl get no
The connection to the server 127.0.0.1:16443 was refused - did you specify the right host or port?

Even microk8s.kubectl cluster-info dump fails with message above. When I run microk8s start it still the same.

Upvotes: 15

Views: 17346

Answers (4)

Ali
Ali

Reputation: 1449

For me Ubuntu 20.04.4 LTS (Focal Fossa), this two commands save my day:

sudo microk8s.refresh-certs --cert ca.crt

and

sudo microk8s.refresh-certs --cert server.crt

Upvotes: 2

hejkerooo
hejkerooo

Reputation: 787

iptables were provisioned by ansible which were messing with microk8s iptables configuration

Upvotes: 0

Алексей С
Алексей С

Reputation: 11

check your /etc/ hosts file there should be these lines

127.0.0.1 localhost 127.0.1.1 name you servers

Upvotes: 0

Wytrzymały Wiktor
Wytrzymały Wiktor

Reputation: 13878

It is hard to tell exactly what might went wrong here but there are few things that you could do in order to fix your issue:

  • .kube/config is missing or not configured correctly. Create or copy a valid kubeconfig file to solve this.

  • You have swap not turned off. With swap enabled, kubelet service will not start. Execute: sudo swapoff -a in order to make sure it is disabled.

  • kubelet might be down. Check kubelet logs and make sure that kube-apiserver is up and running.

  • Check which ports are appropriate to use with the telnet command.

Upvotes: 7

Related Questions