Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save grampelberg/7782c776e234adebe625e50b23dd6291 to your computer and use it in GitHub Desktop.
Save grampelberg/7782c776e234adebe625e50b23dd6291 to your computer and use it in GitHub Desktop.
.PHONY: create
create: bootstrap
@# Create a cluster in GKE with some sane defaults.
@# Options:
@#
@# CLUSTER_NAME :: ${CLUSTER_NAME}
@# MACHINE_TYPE :: ${MACHINE_TYPE}
@# MAX_NODES :: ${MAX_NODES}
@# NETWORK :: ${NETWORK}
@# PROJECT :: ${PROJECT}
@# VERSION :: ${VERSION}
@# ZONE :: ${ZONE}
$(call gcloud_container) \
create "$(CLUSTER_NAME)" \
--cluster-version "$(VERSION)" \
--machine-type "$(MACHINE_TYPE)" \
--network "$(NETWORK)" \
--subnetwork "$(NETWORK)" \
--max-nodes "$(MAX_NODES)" \
--no-enable-basic-auth \
--image-type "COS" \
--disk-size "100" \
--scopes "https://www.googleapis.com/auth/devstorage.read_write","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring","https://www.googleapis.com/auth/pubsub","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/sqlservice.admin","https://www.googleapis.com/auth/taskqueue","https://www.googleapis.com/auth/trace.append" \
--enable-kubernetes-alpha \
--preemptible \
--num-nodes "1" \
--min-nodes "1" \
--enable-cloud-logging \
--enable-cloud-monitoring \
--enable-autoscaling \
--enable-network-policy \
--addons HorizontalPodAutoscaling,HttpLoadBalancing,KubernetesDashboard
$(MAKE) get-auth set-current run-proxy
kubectl create clusterrolebinding \
$$(whoami)-cluster-admin \
--clusterrole=cluster-admin \
--user=$$(gcloud config get-value account)
kubectl apply -f rbac.yaml
kubectl apply -f tiller.yaml
helm init --service-account tiller
@echo "Go to $(DASHBOARD) for the dashboard. Note: RBAC is permissive for the dashboard, no need to enter a token."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment