Created
August 10, 2017 15:47
-
-
Save achanda/05f70b186ab6c5f38372bee18bde00b2 to your computer and use it in GitHub Desktop.
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
$USER="autodeploy" | |
kubectl create "$USER" | |
secret=$(kubectl get sa "$USER" -o json | jq -r .secrets[].name) | |
kubectl get secret $secret -o json | jq -r '.data["ca.crt"]' | base64 -D > ca.crt | |
user_token=$(kubectl get secret $secret -o json | jq -r '.data["token"]' | base64 -D) | |
kubectl config set-cluster mycluster \ | |
--embed-certs=true \ | |
--server="$ENDPOINT" \ | |
--certificate-authority=./ca.crt | |
kubectl config set-credentials "$USER" --token="$user_token" | |
kubectl config set-context deployment-context \ | |
--cluster=mycluster \ | |
--user="$USER | |
kubectl config use-context deployment-context |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment