ubuntukubernetesnetworkingportufw

Port 6443 connection refused when setting up kubernetes


I am reading the documentation for using kubeadm to set up a Kubernetes cluster. I am running Ubuntu Server 20.04 on three VMs but am currently only working with one of them before doing the configuration on the other two. I have prepared containerd and disabled swap, but am getting stuck with enabling the required ports. I first configured ufw to only allow incoming traffic from port 22 using the OpenSSH application profile. After reading up on enabling required ports, I have run the commands:

sudo ufw allow 6443, sudo ufw allow 6443/tcp, and sudo ufw allow 6443/udp.

When I try using telnet to connect, it fails:

telnet 127.0.0.1 6443
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused

...and when using the private IP other computers connect to it with:

telnet 192.168.50.55 6443
Trying 192.168.50.55...
telnet: Unable to connect to remote host: Connection refused

If I tell telnet to use port 22, it works just fine:

telnet 127.0.0.1 22
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.3
^]
telnet> close
Connection closed.

Is there something I am doing wrong with the firewall configuration? Or is it another thing?

Thank you for the help,

foxler2010


Solution

  • 1. Install nmap " sudo apt-get install nmap "
    
    2. listen to port 6443 "nc -l 6443"
    
    3. open a another terminal/window and connect to 6443 port "nc -zv 192.168.50.55 6443" . It should say connected.