[kubelet-check] The HTTP call equal to ‘curl -sSL http://localhost:10248/healthz‘ failed with error: Get “http://localhost:10248/healthz“: dial tcp 127.0.0.1:10248: connect: connection refused.

进入 /etc/systemd/system/kubelet.service.d,查看是否存在10-kubeadm.conf,在文件末尾添加:

  1. Environment="KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true --fail-swap-on=false"

执行如下命令重新加载配置:

systemctl daemon-reload
systemctl restart kubelet.service

因为第一次初始化失败后有垃圾数据没有清理,执行 kubeadm reset 重置。

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/a70459be0084506e4ec919aa1c114638878db11b/Documentation/kube-flannel.yml

这是安装 pod 插件引起的错误,连不上外网导致,我们这里使用 wget。

Error: INSTALLATION FAILED: unable to build kubernetes objects from release

在使用 helm install ui stable/weave-scope产生此错误。

更换 stable repo 源,ali 的非最新版本,所以百度出来有的是手动改,有的是用shell改,根本原因还是chart源没有实时更新以匹配k8s版本

我这里使用的是azure的:helm repo add stable http://mirror.azure.cn/kubernetes/charts/

error: failed to create clusterrolebinding: Post “http://localhost:8080/apis/rbac.authorization.k8s.io/v1/clusterrolebindings?fieldManager=kubectl-create”: dial tcp 127.0.0.1:8080: connect: connection refused

错误“可能”表明您未连接到集群。您可以使用以下命令进行连接

Error: client: response is invalid json. The endpoint is probably not valid etcd cluster endpoint

解决方案,亲测有效:
1、修改 etcd.service systemd unit文件
加入 —enable-v2=true。
2、调整写入命令
ETCDCTL_API=2 etcdctl —endpoints=${ETCD_ENDPOINTS} —ca-file=/opt/k8s/work/ca.pem —cert-file=/opt/k8s/work/flanneld.pem —key-file=/opt/k8s/work/flanneld-key.pem mk ${FLANNEL_ETCD_PREFIX}/config ‘{“Network”:”‘${CLUSTER_CIDR}’”, “SubnetLen”: 21, “Backend”: {“Type”: “vxlan”}}’
FLANNEL_ETCD_PREFIX 环境变量需要自己手动加一下。我是随便给了个值。


[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory “/etc/kubernetes/manifests”. This can take up to 4m0s[kubelet-check] Initial timeout of 40s passed.