报错信息:
[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.
过程回顾:
[root@test2 ~]# kubeadm init \ --apiserver-advertise-address=192.168.2.129 \ --image-repository registry.aliyuncs.com/google_containers \ --kubernetes-version v1.13.3 \ --service-cidr=10.1.0.0/16 \ --pod-network-cidr=10.244.0.0/16 ...... [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.
问题解决:
[root@test2 ~]# vim /etc/systemd/system/kubelet.service.d/10-kubeadm.conf ... Environment="KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true --fail-swap-on=false" [root@test2 ~]# systemctl daemon-reload [root@test2 ~]# systemctl restart kubelet [root@test2 ~]# kubeadm init \ --apiserver-advertise-address=192.168.2.129 \ --image-repository registry.aliyuncs.com/google_containers \ --kubernetes-version v1.13.3 \ --service-cidr=10.1.0.0/16 \ --pod-network-cidr=10.244.0.0/16 ...... Your Kubernetes master has initialized successfully! To start using your cluster, you need to run the following as a regular user: mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config You should now deploy a pod network to the cluster. Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at: https://kubernetes.io/docs/concepts/cluster-administration/addons/ You can now join any number of machines by running the following on each node as root: kubeadm join 192.168.2.129:6443 --token si974n.v8615659h9x6x4xe --discovery-token-ca-cert-hash sha256:d6d1c5d0290ee0217d14d7d6bdea23b1fc911186e0ea94847a1f52d8ed32761d
重新初始化Kubenetes成功。