k8s join语句生成脚本
#!/bin/bash
if [ $EUID -ne 0 ];then
echo "You must be root (or sudo) to run this script"
exit 1
fi
token=`kubeadm token create`
cert_hash=`openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.* //'`
echo "Refer the following command to join kubernetes cluster:"
echo "kubeadm join api-server.vops.top:16443 --token ${token} --discovery-token-ca-cert-hash sha256:${cert_hash}"