Google Cloud DevOps Series: Continuous Development Workflow
Google Cloud DevOps Series: Part-3
Welcome to Part 3 of the Google Cloud DevOps series.. You can find the complete series Here
Continuous Development Workflow: Hands-on Demo
‘gcloud’ is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell. In the cloud shell environment type the following command to set the project.
gcloud config set project <Your-Project-Name>
Set ‘PROJECT_NAME’ variable
PROJECT_NAME=<Your-Project-Name>
Create the GKE cluster for development purpose
gcloud beta container --project "$PROJECT_NAME" clusters create "dev-cluster" --zone "us-central1-a" --no-enable-basic-auth --cluster-version "1.20.10-gke.301" --release-channel "regular" --machine-type "e2-medium" --image-type "COS_CONTAINERD" --disk-type "pd-standard" --disk-size "10" --metadata disable-legacy-endpoints=true --scopes "https://www.googleapis.com/auth/cloud-platform" --max-pods-per-node "110" --num-nodes "6" --logging=SYSTEM,WORKLOAD --monitoring=SYSTEM --enable-ip-alias --network "projects/placeholder-322809/global/networks/default" --subnetwork "projects/placeholder-322809/regions/us-central1/subnetworks/default" --no-enable-intra-node-visibility --default-max-pods-per-node "110" --no-enable-master-authorized-networks --addons HorizontalPodAutoscaling,HttpLoadBalancing,GcePersistentDiskCsiDriver --enable-autoupgrade --enable-autorepair --max-surge-upgrade 1 --max-unavailable-upgrade 0 --enable-shielded-nodes --node-locations "us-central1-a"
Verify newly created GKE cluster on Google Cloud console
Go to the cloud Shell and connect to the cluster
gcloud container clusters get-credentials dev-cluster — zone us-central1-a — project $PROJECT_NAME
Open ide.cloud.google.com and navigate to the microservices-demo folder which you have already cloned. (Note — Refer to the Blog-2 for steps)
Locate the skaffold.yaml file
Select the ‘Cloud Code’ option
Select the ‘Run on Kubernetes’ option
Select the appropriate GKE cluster
It will start building the Microservices. Check the progress in the output section.
Access the application:
Note the Public IP address of the frontend-external service. Click on the Public IP address and it will open the application in your default browser.
Make the code changes and observe automatic deployment
Go to the file ‘microservices-demo/src/frontend/templates/header.html’ in the source codebase and locate the following text
Free shipping with $75 purchase!
Change ‘$75’ to ‘$150’
Free shipping with $150 purchase!
Skaffold detects the change automatically, starts the build and deploy process for the corresponding Microservice. Skaffold does not build and deploy other microservices which are not associated with the code change.
Coming up…
In this blog, we learned continuous development workflow with GKE in Google Cloud. Now Guhan became even more curious to learn how he can implement end to end CI/CD workflow on Google cloud for Samajik’s containerised workloads. Stay tuned to Ram and Guhan’s conversation to know more about this..
Contributors: Shijimol A K, Dhandus, Anchit Nishant, Jeevana Hegde, Tushar Gupta
Update: You can read Part-4 here.