问题:执行kubeadm join 卡住并失败
[root@node2 ~]# kubeadm join 192.168.0.10:6443 --token r32qb0.6wrw8z199qdfdvs1 --discovery-token-ca-cert-hash sha256:eb5e2351e503035218d602def2295c6e61226c2e1f23e70044dfc163c5296d81
[preflight] Running pre-flight checks
error execution phase preflight: couldn't validate the identity of the API Server: Get "https://192.168.0.10:6443/api/v1/namespaces/kube-public/configmaps/cluster-info?timeout=10s": dial tcp 192.168.0.10:6443: connect: no route to host
To see the stack trace of this error execute with --v=5 or higher
[root@node2 ~]#
[root@node2 ~]#
[root@node2 ~]#
排查过程:
1: “ no route to host”, 没有发现192.168.0.10:6443 主机; 查看是否能ping通
发现问题:主机网络不通
解决问题
2、讲内网ip映射到公网ip上
[root@node2 ~]# iptables -t nat -A OUTPUT -d 192.168.0.10 -j DNAT --to-destination “公网IP”
验证
[root@node2 ~]# telnet 192.168.0.10 6443
加入集群成功