Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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