Skip to content

Instantly share code, notes, and snippets.

@nmittler
Created August 6, 2020 23:47
Show Gist options
  • Save nmittler/c02982dca3a797a20abdddc8ef225f7f to your computer and use it in GitHub Desktop.
Save nmittler/c02982dca3a797a20abdddc8ef225f7f to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -euo pipefail
# Create the cluster
# --cluster-version=latest --node-version=latest
gcloud container clusters create $CLUSTER --release-channel rapid \
--zone $ZONE --project $PROJECT --username "admin" \
--machine-type "n1-standard-4" --image-type "COS" --disk-size "100" \
--scopes "https://www.googleapis.com/auth/compute","https://www.googleapis.com/auth/devstorage.read_only",\
"https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring",\
"https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management.readonly",\
"https://www.googleapis.com/auth/trace.append" \
--num-nodes "4" --network "default" --enable-stackdriver-kubernetes --enable-ip-alias
# Retrieve your credentials for kubectl.
gcloud container clusters get-credentials $CLUSTER --zone $ZONE --project $PROJECT
# Grant cluster administrator (admin) permissions to the current user.
kubectl create clusterrolebinding cluster-admin-binding \
--clusterrole=cluster-admin \
--user=$(gcloud config get-value core/account)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment