hello guys
I was struggling with this problem for about 2 days until I came across this link and my problem was completely solved according to the point mentioned in the link.
https://www.vnoob.com/2022/12/kubectl-6443-connection-refused/
Note that at the end, mix the following two commands:
$ sudo systemctl restart containerd
$ sudo systemctl restart kubelet
- Note: The important point is that at the same time you must have correctly set the settings such as ip address in the /etc/kubernetes/kubelet.conf file.