0

I have configured Kubernetes using kubeadm in cent os stream 9. When I issue kubectl commands i am getting this error often

The connection to the server xx.xxx.xx.xx:6443 was refused - did you specify the right host or port?

I have used Flannel as CNI.

I have tried the swapoff -a command. And done export KUBECONFIG=/etc/kubernetes/admin.conf Restarting kubelet works sometimes but again gets the same error.

kube-api-server logs shows as follows,

2023-05-22T14:26:09.871029029+05:30 stderr F W0522 08:56:09.870881       1 storage_scheduling.go:106] unable to get PriorityClass system-node-critical: Get "https://[::1]:6443/apis/scheduling.k8s.io/v1/priorityclasses/system-node-critical": dial tcp [::1]:6443: connect: connection refused. Retrying...
2023-05-22T14:26:09.8710991+05:30 stderr F E0522 08:56:09.870905       1 storage_rbac.go:187] unable to initialize clusterroles: Get "https://[::1]:6443/apis/rbac.authorization.k8s.io/v1/clusterroles": dial tcp [::1]:6443: connect: connection refused
2023-05-22T14:26:09.871143932+05:30 stderr F W0522 08:56:09.871088       1 storage_scheduling.go:106] unable to get PriorityClass system-node-critical: Get "https://[::1]:6443/apis/scheduling.k8s.io/v1/priorityclasses/system-node-critical": dial tcp [::1]:6443: connect: connection refused. Retrying...
2023-05-22T14:26:09.871221589+05:30 stderr F F0522 08:56:09.871144       1 hooks.go:203] PostStartHook "scheduling/bootstrap-system-priority-classes" failed: unable to add default system priority classes: timed out waiting for the condition

Please provide a solution. I have tried out most of the solutions from Google

  • `connection refused` indicates that the service you want to reach is not running. It makes sense that restarting it (or starting it) fixes that. Read the error logs to find out why it stops. – Gerald Schneider May 22 '23 at 06:03
  • kube-api-server logs shows, storage_scheduling.go:106] unable to get PriorityClass system-node-critical:": dial tcp [::1]:6443: connect: connection refused. Retrying... 2023-05-22T14:17:52.882543812+05:30 stderr F F0522 08:47:52.882492 1 hooks.go:203] PostStartHook "scheduling/bootstrap-system-priority-classes" failed: unable to add default system priority classes: timed out waiting for the condition stderr,storage_rbac.go:187] unable to initialize clusterroles: Get "https://[::1]:6443/apis/rbac.authorization.k8s.io/v1/clusterroles": dial tcp [::1]:6443: connect: connection refused – sreelakshmi May 22 '23 at 08:53
  • Please edit your question to add additional information. It's unreadable in the comments. – Gerald Schneider May 22 '23 at 08:55
  • I have edited the question – sreelakshmi May 22 '23 at 09:02

0 Answers0