Created
May 25, 2019 03:03
-
-
Save jadametz/e308e94805f47ec937a681672cbe3259 to your computer and use it in GitHub Desktop.
Updates ~/.kube/config for a Digital Ocean K8s cluster
This file contains 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
#!/usr/bin/env bash | |
# export DO_TOKEN=foo | |
# export K8S_CLUSTER_ID=bar | |
if [[ -z "$DO_TOKEN" ]] || [[ -z "$K8S_CLUSTER_ID" ]]; then | |
echo "DO_TOKEN and K8S_CLUSTER_ID must be set" 1>&2 | |
exit 1 | |
fi | |
echo "Updating DigitalOcean K8s config file..." | |
curl -s \ | |
--request GET \ | |
--header "Content-Type: application/json" \ | |
--header "Authorization: Bearer $DO_TOKEN" \ | |
--url https://api.digitalocean.com/v2/kubernetes/clusters/$K8S_CLUSTER_ID/kubeconfig \ | |
--output config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment