Score:0

Kubernetes connection refuses often

kn flag

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

in flag
`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.
sreelakshmi avatar
kn flag
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
in flag
Please edit your question to add additional information. It's unreadable in the comments.
sreelakshmi avatar
kn flag
I have edited the question
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.