Home > Enterprise >  The connection to the server 127.0.0.1:6443 was refused - did you specify the right host or port?
The connection to the server 127.0.0.1:6443 was refused - did you specify the right host or port?

Time:10-13

I have setup the Kubernetess cluster with Kubespray enter image description here

Once i restart node and check the nodes status i am getting as below

kubectl get nodes

The connection to the server 127.0.0.1:6443 was refused - did you specify the right host or port? enter image description here Environment: OS : CentOS 7 Kubespray kubelet version: 1.22.3

Need your help on this.

Regards, Zain

CodePudding user response:

enter image description here

i have tried above steps, but it didn't work.

enter image description here

even though i am not able to restart the services of kubelet. it show as above

and less /var/log/containers/kube-apiserver-kmaster_kube-system_kube-apiserver-5694f2bcb2af56bd39298be42e3a01d08747130894bd93225471b69a47d9c089.log logs as below

{"log":"I1012 08:49:59.807359       1 controller.go:132] OpenAPI AggregationController: action for item k8s_internal_local_delegation_chain_0000000000: Nothing (removed from the queue).\n","stream":"stderr","time":"2022-10-12T08:49:59.8129483Z"}
{"log":"I1012 08:50:00.107375       1 storage_scheduling.go:148] all system priority classes are created successfully or already exist.\n","stream":"stderr","time":"2022-10-12T08:50:00.1099276Z"}
{"log":"I1012 08:50:00.595189       1 controller.go:611] quota admission added evaluator for: leases.coordination.k8s.io\n","stream":"stderr","time":"2022-10-12T08:50:00.5956859Z"}
{"log":"I1012 08:50:28.814949       1 controller.go:611] quota admission added evaluator for: endpoints\n","stream":"stderr","time":"2022-10-12T08:50:28.816098Z"}
{"log":"I1012 08:50:28.903742       1 controller.go:611] quota admission added evaluator for: endpointslices.discovery.k8s.io\n","stream":"stderr","time":"2022-10-12T08:50:28.9040023Z"}
{"log":"W1012 09:02:31.484506       1 clientconn.go:1326] [core] grpc: addrConn.createTransport failed to connect to {172.20.54.63:2379 172.20.54.63 \u003cnil\u003e 0 \u003cnil\u003e}. Err: connection error: desc = \"transport: Error while dialing dial tcp 172.20.54.63:2379: connect: connection refused\". Reconnecting...\n","stream":"stderr","time":"2022-10-12T09:02:31.5310675Z"}

CodePudding user response:

Below step can solve your issue. kubelet may be down, use the below commands on the master node.

   1. sudo -i

   2. swapoff -a

   3. exit

   4. strace -eopenat kubectl version

Then try using kubectl get nodes.

  • Related