公网IP不在信任IP列表中的问题
报错内容:couldn’t validate the identity of the API Server: certificate is valid for 10.96.0.1, 172.17.157.248, not 47.100.195.253
error execution phase preflight: couldn’t validate the identity of the API Server: Get “https://47.100.195.253:6443/api/v1/namespaces/kube-public/configmaps/cluster-info?timeout=10s”: x509: certificate is valid for 10.96.0.1, 172.17.157.248, not 47.100.195.253
解决方案
公网IP未添加至信任IP中,Master Node需要重置启动,在启动时需要添加公网IP的参数--apiserver-cert-extra-sans=120.79.23.226
。
ConfigMap获取失败的问题
报错内容:unable to fetch the kubeadm-config ConfigMap: failed to get config map
error execution phase preflight: unable to fetch the kubeadm-config ConfigMap: failed to get config map: Get “https://172.17.157.248:6443/api/v1/namespaces/kube-system/configmaps/kubeadm-config?timeout=10s”: dial tcp 172.17.157.248:6443: connect: no route to host
解决方案
Token失效的问题
报错内容:couldn’t validate the identity of the API Server: could not find a JWS signature in the cluster-info ConfigMap for token ID “1t8xr4”
kubeadm join 47.100.195.253:6443 --token 1t8xr4.eqlezpou8dm8mpcy --discovery-token-ca-cert-hash sha256:9170e19223b6ba70aedef919f2198467278e67e11826f8d92dc4d1cba5b93873
[preflight] Running pre-flight checks
error execution phase preflight: couldn't validate the identity of the API Server: could not find a JWS signature in the cluster-info ConfigMap for token ID "1t8xr4"
To see the stack trace of this error execute with --v=5 or higher
解决方案(一)
查看Master节点的Token
kubeadm token list
创建新Token
[root@iZuf68qk0bio1l786kylamZ ~]# kubeadm token create
htpca1.bjmrvnfl2mojtvmc
[root@iZuf68qk0bio1l786kylamZ ~]# kubeadm token list
TOKEN TTL EXPIRES USAGES DESCRIPTION EXTRA GROUPS
htpca1.bjmrvnfl2mojtvmc 23h 2021-12-25T09:31:34Z authentication,signing <none> system:bootstrappers:kubeadm:default-node-token
[root@iZuf68qk0bio1l786kylamZ ~]# openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.* //'
9170e19223b6ba70aedef919f2198467278e67e11826f8d92dc4d1cba5b93873
替换新的Token和sha256再执行Work Node的添加操作
kubeadm join 172.17.157.248:6443 --token 1t8xr4.eqlezpou8dm8mpcy \
--discovery-token-ca-cert-hash sha256:9170e19223b6ba70aedef919f2198467278e67e11826f8d92dc4d1cba5b93873
解决方案(二)
# 生成一个新的 token 令牌(比上面的方便)
$ kubeadm token generate
# 直接生成 join 命令(比上面的方便)
$ kubeadm token create <token_generate> --print-join-command --ttl=0