简体   繁体   中英

The connection to the server x.x.x.x:6443 was refused. Did you specify the right host or port?

I am installing kubeadm in aws ec2instances in ubuntu. I opened the security group for all traffic externally and internal to that security group also. But i am facing this problem continously and not able to move forward.Please refer to this url [https://i.stack.imgur.com/ziDYx.png] to see the error exactly.

I tried flanel and calico networks but both giving same error. Can someone tell me where i am doing wrong?

I was facing the same problem.

I had 3 EC2 servers and bootstrapped the cluster via kubeadm .

My solution was to use Ubuntu 20.04 (Focal Fossa) as a base image for my EC2 instances. (NOT the latest one!)

I hope that helps you.


This error (kubectl can not connect to the API server) usually happens because of two main reasons:

  1. misleading kubeconfig
  2. Certificates

I suggest trying the below commands, and hopefully, you are good to go.


First of all, try to update your kubeconfig:

kubectl config view --raw > ~/.kube/config

If your problem doesn't solve with the first command, then probably you should renew/update your cluster certificates:

Here are some examples:

  • Microk8s
sudo microk8s.refresh-certs --cert ca.crt
kubeadm certs renew <command>
  • So on and so forth...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM