kubectl connection issues on Ubuntu 22.04LTS with Kubernetes 1.26.0

I have installed kubeadm, kubelet and kubectl using sudo apt install command, and they are all version 1.26.0. I use Ubuntu 22.04LTS machine. I just wanted to test and use Kubernetes on my local computer. But I don’t know why I get the following error messages whenever I try kubectl commands like kubelctl get pods/nodes/etc:

kubectl get pods
E1212 08:13:11.758898    4321 memcache.go:238] couldn't get current server API group list: Get "https://192.168.1.2:6443/api?timeout=32s": dial tcp 192.168.1.2:6443: connect: connection refused
E1212 08:13:11.759479    4321 memcache.go:238] couldn't get current server API group list: Get "https://192.168.1.2:6443/api?timeout=32s": dial tcp 192.168.1.2:6443: connect: connection refused
E1212 08:13:11.761197    4321 memcache.go:238] couldn't get current server API group list: Get "https://192.168.1.2:6443/api?timeout=32s": dial tcp 192.168.1.2:6443: connect: connection refused
E1212 08:13:11.762636    4321 memcache.go:238] couldn't get current server API group list: Get "https://192.168.1.2:6443/api?timeout=32s": dial tcp 192.168.1.2:6443: connect: connection refused
E1212 08:13:11.764083    4321 memcache.go:238] couldn't get current server API group list: Get "https://192.168.1.2:6443/api?timeout=32s": dial tcp 192.168.1.2:6443: connect: connection refused
The connection to the server 192.168.1.2:6443 was refused - did you specify the right host or port?

I don’t know why I get this error message.

Read more here: Source link