Part of this answer refers to GPT, GPT_Pro for better problem solving
When Kubeadm is deployed single-point, If the kubectl apply -f kube-flannelyml command is executed, The connection to the server 192 168.50 100.8080 was refused - did you specify the right host or port? The connection to the server 192 168.50 100.8080 was refused - Did you specify the right host or port? May be caused by the following reasons:
-
The IP address and port number of the connection are incorrect. Kubeadm manages the cluster through kubectl, so you need to provide the correct IP and port number to connect. You can first check that the IP address and port number are correct and that you have sufficient permissions to access them.
-
If both the IP and port numbers are correct, you may need to reconfigure the kubeconfig file. The kubeconfig file is an important file that connects the master node in the Kubeadm cluster and is used to record cluster information. If the master node changes, the kubeconfig file needs to be regenerated.
# 使用kubeadm生成配置文件
kubeadm config print init-defaults > kubeadm.yaml
# 使用生成的配置文件初始化集群并生成kubeconfig文件
kubeadm init --config=kubeadm.yaml --upload-certs
- In addition, you need to pay attention to whether the versions of the front-end and back-end services are consistent. If the versions are inconsistent, the connection will fail. To synchronize the back-end service versions, upgrade the cluster using the kubeadm upgrade command:
# 查看版本信息
kubeadm version
# 升级版本
kubeadm upgrade apply
If the answer is helpful, please accept it.