Last active
June 3, 2019 06:29
-
-
Save zryfish/dbdb938d8757e3d4a9380b15c5ea842b to your computer and use it in GitHub Desktop.
token.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source /data/kubernetes/env.sh | |
| KUBECONFIG=`base64 /etc/kubernetes/admin.conf | tr -d "\n"` | |
| INITTOKEN=`kubeadm token list | grep forever | awk '{print $1}'` | |
| JSON="{\"clusters\":{\"CLUSTERID\":{\"hosts\":{\"master\":{\"INSTANCEID\":{\"token\":\"{\\\"init_token\\\":\\\"INITTOKEN\\\",\\\"adminconf\\\":\\\"KUBECONFIG\\\"}\"}}}}}}" | |
| echo $JSON | sed -e "s/CLUSTERID/${CLUSTER_ID}/g" | sed -e "s/INSTANCEID/${HOST_INSTANCE_ID}/g" | sed -e "s/INITTOKEN/${INITTOKEN}/g" | sed -e "s/KUBECONFIG/${KUBECONFIG}/g" > token.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment