K8S常见报错处理

x33g5p2x  于2022-06-27 转载在 其他  
字(0.9k)|赞(0)|评价(0)|浏览(452)

1 right host or port

The connection to the server localhost:8080 was refused - did you specify the right host or port?
解决方法:

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

2 初始化 healthz

The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp [::1]:10248: connect: connection refused

解决方法

vim /etc/docker/daemon.json
{
  "registry-mirrors": ["https://q5vcymug.mirror.aliyuncs.com"],
  "exec-opts": ["native.cgroupdriver=systemd"]
}
systemctl restart docker
kubeadm reset -f

3 检查不健康 healthz

kubectl get cs

报错:
Get "http://127.0.0.1:10251/healthz": dial tcp 127.0.0.1:10251: connect: connection

解决方法:

vim /etc/kubernetes/manifests/kube-controller-manager.yaml

注释掉27行:# - --port=0

vim /etc/kubernetes/manifests/kube-scheduler.yaml

注释掉19行:# - --port=0

然后master节点重启:kubelet(等待几秒即可)

systemctl restart kubelet.service

相关文章