Skip to content

Instantly share code, notes, and snippets.

@mikesparr
Last active September 13, 2020 03:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikesparr/fd3eca5c7c00349a3a79ed6b54a75445 to your computer and use it in GitHub Desktop.
Save mikesparr/fd3eca5c7c00349a3a79ed6b54a75445 to your computer and use it in GitHub Desktop.
Anthos GKE on AWS (cluster)
#!/usr/bin/env bash
# https://cloud.google.com/anthos/gke/docs/aws/how-to/creating-user-cluster
# from setup-02-mgmt.sh
unset HTTP_PROXY # reset
export NODE_KEY_PATH=$(PWD)/node-key.json
export GOOGLE_APPLICATION_CREDENTIALS=$NODE_KEY_PATH
# create example user cluster config
terraform output cluster_example > cluster-0.yaml
# make sure bastion_tunnel.sh is running
./bastion-tunnel.sh -N &
# set HTTP_PROXY env var (for kubectl operations)
export HTTP_PROXY=http://localhost:8118 # you will have to unset this if running TF
# create first cluster from manifest generated above
kubectl apply -f cluster-0.yaml
sleep 600 # give time for cluster to reconcile
# create kubeconfig for new cluster (make sure bastion_tunnel.sh and HTTP_PROXY var set)
anthos-gke aws clusters get-credentials cluster-0
# get cluster-0 info and test kubeconfig
kubectl cluster-info
#################################################################
# OPTIONALLY VIEW CLUSTER STATUS (SWITCH BACK TO MGMT)
#
# anthos-gke aws management get-credentials
# kubectl get AWSClusters
#################################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment