有勇气的牛排博客

K8S常见报错处理

有勇气的牛排 1191 云原生 2021-08-26 21:57:34

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

image.png

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

image.png

解决方法:

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

留言

专栏
文章
加入群聊