Kubernetes: Error The connection to the server host:6443 was refused – did you specify the right host or port?
Hoy os voy a enseñar como arreglar un pequeño problema que suele ocurrir cuando montas un cluster kubernetes…
A mí me ha pasado varias veces, y la mayoría de veces me coincide con una caída abrupta de la máquina virtual. Porque se ha roto un disco duro del clúster de virtualización (VMware o Proxmox), o la he apagado no ordenadamente por un descuido.
El error en cuestión es:
1 |
Kubernetes: Error The connection to the server host:6443 was refused - did you specify the right host or port? |
Al ingresar en el nodo master, y lanzar cualquier comando me devuelve el error en cuestión:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
MacBook-Pro-de-Raul:~ elblogdenegu$ ssh 192.168.2.190 elblogdenegu@192.168.2.190's password: Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-65-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Wed Mar 17 21:09:17 UTC 2021 System load: 2.46 Processes: 129 Usage of /: 35.1% of 19.56GB Users logged in: 0 Memory usage: 13% IPv4 address for docker0: 172.17.0.1 Swap usage: 0% IPv4 address for ens18: 192.168.2.190 * Introducing self-healing high availability clusters in MicroK8s. Simple, hardened, Kubernetes for production, from RaspberryPi to DC. https://microk8s.io/high-availability 63 updates can be installed immediately. 32 of these updates are security updates. To see these additional updates run: apt list --upgradable Last login: Wed Mar 17 21:05:38 2021 from 192.168.2.212 elblogdenegu@kbmaster:~$ kubectl get pods The connection to the server 192.168.2.190:6443 was refused - did you specify the right host or port? |
Para solucionarlo, no sé si hay otras opciones, a mí me funciona lo siguiente:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
elblogdenegu@kbmaster:~$ sudo -i [sudo] password for elblogdenegu: root@kbmaster:~# swapoff -a root@kbmaster:~# exit logout elblogdenegu@kbmaster:~$ strace -eopenat kubectl version openat(AT_FDCWD, "/sys/kernel/mm/transparent_hugepage/hpage_pmd_size", O_RDONLY) = 3 openat(AT_FDCWD, "/proc/version", O_RDONLY) = 3 openat(AT_FDCWD, "/usr/bin/kubectl", O_RDONLY|O_CLOEXEC) = 6 --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3786, si_uid=1000} --- Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.2", GitCommit:"faecb196815e248d3ecfb03c680a4507229c2a56", GitTreeState:"clean", BuildDate:"2021-01-13T13:28:09Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"} The connection to the server 192.168.2.190:6443 was refused - did you specify the right host or port? +++ exited with 1 +++ |
Ahora volvéis a probar:
1 2 3 4 5 |
elblogdenegu@kbmaster:~$ kubectl get nodes NAME STATUS ROLES AGE VERSION kbmaster Ready control-plane,master 41d v1.20.2 kubernetes01 Ready <none> 41d v1.20.2 kubernetes02 Ready <none> 41d v1.20.2 |
Te ha gustado la entrada SGUENOS EN TWITTER O INVITANOS A UN CAFE?
No me funcionó. Mismo mensaje.