failed with error: Get http://localhost:10248/healthz

[kubelet-check] It seems like the kubelet isn’t running or healthy.
[kubelet-check] 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.

今天遇到这个问题,查资料各种,有说是host文件的,检查,无误,curl -i http://localhost:10248/healthz,返回200,ok看着什么都正常
最后发现问题,端口!!!!!!!!!

错误示范

kubeadm init --control-plane-endpoint="192.168.40.200:6444" --image-repository="k8s.gcr.io" --pod-network-cidr="10.244.0.0/16" --ignore-preflight-errors=Swap --kubernetes-version="v1.18.0" --upload-certs --v=6

正确

–control-plane-endpoint参数,要么不加端口,要么加6443端口,否则都会报这个错
用yam文件的话,选项是controlPlaneEndpoint: "192.168.40.200:6443"或者ontrolPlaneEndpoint: “192.168.40.200”

kubeadm init --control-plane-endpoint="192.168.40.200:6443" --image-repository="k8s.gcr.io" --pod-network-cidr="10.244.0.0/16" --ignore-preflight-errors=Swap --kubernetes-version="v1.18.0" --upload-certs --v=6
kubeadm init --control-plane-endpoint="192.168.40.200" --image-repository="k8s.gcr.io" --pod-network-cidr="10.244.0.0/16" --ignore-preflight-errors=Swap --kubernetes-version="v1.18.0" --upload-certs --v=6

–control-plane-endpoint选项实际上影响到的是 /etc/kubernetes/admin.conf 文件中对外发布出来的server,如果你在–control-plane-endpoint参数中加修改了端口,没有使用–apiserver-bind-port选项指定成你修改端口,你必须使用nginx或者haproxy来代理你指定的端口到6443,或者是修改配置文件中的端口,否则将报错,检查不通过

你可能感兴趣的:(运维,linux)