Skip to content

Instantly share code, notes, and snippets.

@viktorbenei
Created May 12, 2019 11:54
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 viktorbenei/0e44b7a6cb33142f2882d506de0fcc73 to your computer and use it in GitHub Desktop.
Save viktorbenei/0e44b7a6cb33142f2882d506de0fcc73 to your computer and use it in GitHub Desktop.
Create a GKE Kubernetes cluster (with Istio addon enabled) and install Knative on top of it
#!/usr/bin/env bash
set -ex
if [ -z "$GCP_PROJECT_ID" ] ; then
echo '[!] GCP_PROJECT_ID is not set - required'
exit 1
fi
gcloud config set project "$GCP_PROJECT_ID"
function create_gke_cluster_with_istio {
# To see which GKE versions are supported/recommended for
# Cloud Run on GKE: https://cloud.google.com/run/docs/gke/cluster-versions
gcloud beta container clusters create knativeexp \
--addons=HorizontalPodAutoscaling,HttpLoadBalancing,Istio \
--machine-type=n1-standard-4 \
--cluster-version=1.12.6 --zone=us-central1-a \
--enable-stackdriver-kubernetes --enable-ip-alias \
--scopes cloud-platform
}
function install_knative {
kubectl apply --filename https://github.com/knative/serving/releases/download/v0.5.0/serving.yaml \
--filename https://github.com/knative/eventing/releases/download/v0.5.0/release.yaml \
--filename https://github.com/knative/eventing-sources/releases/download/v0.5.0/eventing-sources.yaml \
--filename https://github.com/knative/serving/releases/download/v0.5.0/monitoring.yaml \
--filename https://raw.githubusercontent.com/knative/serving/v0.5.0/third_party/config/build/clusterrole.yaml
}
# MAIN
create_gke_cluster_with_istio
# re-run the install - known issue: https://github.com/knative/serving/issues/2940
install_knative || install_knative
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment