忘记token怎么加入k8s集群

2019-11-04  本文已影响0人  钾肥尔德

生成一条永久有效的token

kubeadm token create --ttl 0

查看当前有效的token

kubectl token list
TOKEN                     TTL       EXPIRES                     USAGES                   DESCRIPTION   EXTRA GROUPS
g71t1o.lbexqns23lhqs9lq   23h       2019-11-05T21:17:01+08:00   authentication,signing   <none>        system:bootstrappers:kubeadm:default-node-token

获取ca证书sha256编码hash值

openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.* //'

8da141a9f8017c141adc0502108ced6178720ff679d9ee43425d13c001e1bc28

node节点加入

kubeadm join 192.168.1.170:6443 --token g71t1o.lbexqns23lhqs9lq \
--discovery-token-ca-cert-hash sha256:8da141a9f8017c141adc0502108ced6178720ff679d9ee43425d13c001e1bc28
上一篇下一篇

猜你喜欢

热点阅读