6443: connect: connection refused

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes version: v1.31.5
Cloud being used: (put bare-metal if not on a public cloud)
Installation method: Local VM
Host OS: ubuntu 24.04.1
CNI and version:
CRI and version:

You can format your yaml by highlighting it and pressing Ctrl-Shift-C, it will make your output easier to read.

I have just created 3 VM’s ubuntu 24.04.1

192.168.2.120 k8s-ctrl
192.168.2.121 k8s-1
192.168.2.122 k8s-2

I was successfully installed the cluster and joined the worker nodes.

root@k8s-ctrl:~# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-1 Ready 97s v1.31.5
k8s-2 Ready 77s v1.31.5
k8s-ctrl Ready control-plane 5m9s v1.31.5
root@k8s-ctrl:~#

as soon as I tried to create nginx, I started getting port 6443 issue.

root@k8s-ctrl:~# kubectl create deployment nginx --image=nginx
error: failed to create deployment: Post “https://192.168.2.120:6443/apis/apps/v1/namespaces/default/deployments?fieldManager=kubectl-create&fieldValidation=Strict”: dial tcp 192.168.2.120:6443: connect: connection refused
root@k8s-ctrl:~#

Now if I run any command I am getting same error.

root@k8s-ctrl:~# kubectl get nodes
The connection to the server 192.168.2.120:6443 was refused - did you specify the right host or port?
root@k8s-ctrl:~#

I don’t see port is open.

root@k8s-ctrl:~#
root@k8s-ctrl:~# netstat -an | grep -i listen | grep 644
root@k8s-ctrl:~#

root@k8s-ctrl:~# curl https://192.168.2.120:6443
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: curl - SSL CA Certificates

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
root@k8s-ctrl:~#

Appreciate your help on this