忘記token怎麼加入k8s叢集
阿新 • • 發佈:2018-11-05
1.生成一條永久有效的token
kubeadm token create --ttl 0
# kubeadm token list TOKEN TTL EXPIRES USAGES DESCRIPTION EXTRA GROUPS dxnj79.rnj561a137ri76ym <invalid> 2018-11-02T14:06:43+08:00 authentication,signing <none> system:bootstrappers:kubeadm:default-node-token o4avtg.65ji6b778nyacw68<forever> <never> authentication,signing <none> system:bootstrappers:kubeadm:default-node-token
2.獲取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/^.* //'
2cc3029123db737f234186636330e87b5510c173c669f513a9c0e0da395515b0
3.node節點加入
kubeadm join 10.167.11.153:6443 --token o4avtg.65ji6b778nyacw68 --discovery-token-ca-cert-hash sha256:2cc3029123db737f234186636330e87b5510c173c669f513a9c0e0da395515b0