Kubernetes环境搭建之 FAQ for nodes
1.在执行下面添加node命令时, 出现下面的截图
kubeadm join 192.168.1.104:6443 --token 8cglur.h4iscdcgzmerrz4y --discovery-token-ca-cert-hash sha256:b86075b9079b21878b75fc7e18be29939605dfac66da58b6a2d216898bb9218e
主要错误信息为
[WARNING Hostname]: hostname "k8s-daniel-2.novalocal" could not be reached
[WARNING Hostname]: hostname "k8s-daniel-2.novalocal": lookup k8s-daniel-2.novalocal on 10.32.148.99:53: no such host
[WARNING Service-Kubelet]: kubelet service is not enabled, please run 'systemctl enable kubelet.service'
[preflight] Some fatal errors occurred:
[ERROR CRI]: container runtime is not running: output: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
, error: exit status 1
[ERROR Service-Docker]: docker service is not active, please run 'systemctl start docker.service'
[ERROR FileContent--proc-sys-net-bridge-bridge-nf-call-iptables]: /proc/sys/net/bridge/bridge-nf-call-iptables does not exist
[ERROR FileContent--proc-sys-net-ipv4-ip_forward]: /proc/sys/net/ipv4/ip_forward contents are not set to 1
[ERROR SystemVerification]: failed to get docker info: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
- 问题解决
– hostnamectl set-hostname k8s-daniel-1
– systemctl start docker.service
– echo 1 >/proc/sys/net/ipv4/ip_forward
– echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables
– systemctl enable docker.service
– systemctl enable kubelet.service
– kubeadm join 192.168.1.104:6443 --token 8cglur.h4iscdcgzmerrz4y --discovery-token-ca-cert-hash sha256:b86075b9079b21878b75fc7e18be29939605dfac66da58b6a2d216898bb9218e
2.无法连接到master 6443端口
- a. 在执行kubeadm join时,遇到下面的问题
- b. solution
-
- 检查master是否有防火墙, 如果有防火墙, 关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
firewall-cmd --state
systemctl status firewalld.servic
-
- 重启kubelet服务
systemctl restart kubelet