我已经在 centos stream 9 中使用 kubeadm 配置了 Kubernetes。当我发出 kubectl 命令时,我经常收到此错误
与服务器 xx.xxx.xx.xx:6443 的连接被拒绝 - 您是否指定了正确的主机或端口?
我已使用 Flannel 作为 CNI。
我尝试了该swapoff -a
命令。export KUBECONFIG=/etc/kubernetes/admin.conf
重新启动 kubelet 有时有效,但再次出现相同的错误。
kube-api-server 日志显示如下,
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
请提供解决方案。我已经尝试了 Google 的大多数解决方案