E0812 13:52:39.153572 17937 memcache.go:265] couldn't get current server API group list: Get "https://192.168.1.165:6443/api?timeout=32s": dial tcp 192.168.1.165:6443: connect: no route to host

I’m in the process of creating a Kubernetes cluster, starting with both the master and worker nodes. After I finished the below steps on the master node, I executed commands such as ‘kubectl cluster-info’ or ‘kubectl version,’ and that’s when I encountered these error messages. In particular, the IP address 192.168.1.165 isn’t assigned to any of the nodes in the cluster. I also checked all the configuration files on both the master and worker nodes, but I couldn’t find this IP address listed anywhere.

mkdir -p $HOME/.kube
sudo cp -f /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

Cluster information:

Kubernetes version:
k8s-master1:~$ kubectl version
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short. Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:“1”, Minor:“27”, GitVersion:“v1.27.3”, GitCommit:“25b4e43193bcda6c7328a6d147b1fb73a33f1598”, GitTreeState:“clean”, BuildDate:“2023-06-14T09:53:42Z”, GoVersion:“go1.20.5”, Compiler:“gc”, Platform:“linux/amd64”}
Kustomize Version: v5.0.1
Unable to connect to the server: dial tcp 192.168.1.165:6443: connect: no route to host

k8s-master1:~$ kubectl get nodes -o wide
E0812 14:02:26.641098 19070 memcache.go:265] couldn’t get current server API group list: Get “https://192.168.1.165:6443/api?timeout=32s”: dial tcp 192.168.1.165:6443: connect: no route to host

k8s-master1:~$ kubectl get nodes
E0812 14:03:58.417007 19128 memcache.go:265] couldn’t get current server API group list: Get “https://192.168.1.165:6443/api?timeout=32s”: dial tcp 192.168.1.165:6443: connect: no route to host

Cloud being used: (put bare-metal if not on a public cloud)
Bare-metal

Installation method:

Host OS:
k8s-master1:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy

k8s-master1:~$ kubectl describe ds -n kube-flannel | grep -i image
E0812 14:09:13.201129 19320 memcache.go:265] couldn’t get current server API group list: Get “https://192.168.1.165:6443/api?timeout=32s”: dial tcp 192.168.1.165:6443: connect: no route to host