Deploy an Elastic Web App with Portworx and Google Cloud Run
This is the final part of the series on Google Cloud Run. In this tutorial, we will explore how to deploy a Cloud Run service that interacts with existing services already deployed on a Google Kubernetes Engine (GKE) cluster.
When the Cloud Run service targets an existing GKE cluster, it is treated like a classic Kubernetes deployment that can talk to internal services exposed through a ClusterIP.
I am going to take a different approach than the scenario covered in the previous tutorial where I demonstrated how a stateless Cloud Run service leveraged a MongoDB instance provisioned in mLab. In the current scenario, a highly available MongoDB instance runs within the default namespace of the GKE cluster. The stateless web application deployed as a Cloud Run service discovers and uses the existing MongoDB instance.
Below is a detailed walkthrough of this scenario:
Step 1: Launch a GKE Cluster
Let’s start by configuring the tools and the environment. Set the PROJECT_ID variable to your GCP project.
PROJECT_ID='[your_project_id]'
ZONE_ID='us-central1-a'
GKE_CLUSTER='gke-px-cloud-run'
gcloud config set project $PROJECT_ID
gcloud config set compute/zone $ZONE_ID
gcloud services enable container.googleapis.com containerregistry.googleapis.com cloudbuild.googleapis.com
gcloud components update
gcloud components install beta
gcloud components install kubectl
gcloud beta container clusters create $GKE_CLUSTER \
--addons=HorizontalPodAutoscaling,HttpLoadBalancing,Istio,CloudRun \
--machine-type=n1-standard-4 \
--cluster-version="1.11.8-gke.6" \
--zone=$ZONE_ID \
--image-type "UBUNTU" \
--disk-type "pd-ssd" \
--disk-size "50" \
--enable-stackdriver-kubernetes \
--enable-ip-alias \
--scopes cloud-platform
At the end of this step, we have a GKE cluster enabled for Istio and Cloud Run.
Read the entire article at The New Stack
Janakiram MSV is an analyst, advisor, and architect. Follow him on Twitter, Facebook and LinkedIn.