master没问题一切ok,再work1添加节点执行命令不成功,报错

来源:9-5 使用kubeadm搭建多节点K8S集群

学习不停止

2020-12-30

主节点正常
master: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 -u):(idu):(id -g) $HOME/.kube/config

Alternatively, if you are the root user, you can run:

export KUBECONFIG=/etc/kubernetes/admin.conf

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/

Then you can join any number of worker nodes by running the following on each as root:

kubeadm join 192.168.1.227:6443 --token 3gbi9i.m0ojo6wagke7a7jv
–discovery-token-ca-cert-hash sha256:8713d26d1d419f8928fa05ce6744bf1b52ad2537a37e4dbe994bc7ff6abaf343

添加从节点的时候报错
kubeadm join 192.168.1.227:6443 --token 3gbi9i.m0ojo6wagke7a7jv --discovery-token-ca-cert-hash sha256:8713d26d1d419f8928fa05ce6744bf1b52ad2537a37e4dbe994bc7ff6abaf343
[preflight] Running pre-flight checks
[WARNING IsDockerSystemdCheck]: detected “cgroupfs” as the Docker cgroup driver. The recommended driver is “systemd”. Please follow the guide at https://kubernetes.io/docs/setup/cri/
[WARNING SystemVerification]: this Docker version is not on the list of validated versions: 20.10.1. Latest validated version: 19.03
[WARNING Hostname]: hostname “work1” could not be reached
[WARNING Hostname]: hostname “work1”: lookup work1 on 100.100.2.136:53: no such host
[preflight] Reading configuration from the cluster…
[preflight] FYI: You can look at this config file with ‘kubectl -n kube-system get cm kubeadm-config -o yaml’
[kubelet-start] Writing kubelet configuration to file “/var/lib/kubelet/config.yaml”
[kubelet-start] Writing kubelet environment file with flags to file “/var/lib/kubelet/kubeadm-flags.env”
[kubelet-start] Starting the kubelet
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap…
[kubelet-check] Initial timeout of 40s passed.
[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.
[kubelet-check] It seems like the kubelet isn’t running or healthy.

写回答

2回答

学习不停止

提问者

2020-12-31

老师帮忙推荐一套k8s的学习视频,年份越新越好,谢谢了

1
1
麦兜搞IT
您好,这个我也没法推荐,咱们慕课上就有吧,要说越新越好,这个很难保证,因为k8s版本变化很快的。
2020-12-31
共1条回复

学习不停止

提问者

2020-12-31

这问题已经解决,是kubelet版本不行,我用的是1.20的,我用1.17的就可以添加

1
0

系统学习Docker 践行DevOps理念

无论你是开发、测试还是运维,Docker都是你的必备技能。

3297 学习 · 1895 问题

查看课程