CI/CD for GKE using Cloud Deploy
This tutorial will guide you through creating a CI/CD Pipeline on the Google Cloud Platform using Cloud Build and Cloud Deploy.
--
Cloud Deploy is the latest service from Google in the Continuous Delivery space and automates deployments of your application into your GKE clusters.
Under the covers it leverages Cloud Build for its job execution platform, integrates with Cloud Operations suite and Cloud Pub/Sub for further automation, and captures and reports on two of your key DORA Metrics.
Let’s take a look.
GCP Services used in this tutorial:
All the source code for this tutorial is available in GitHub.
Implementation Steps
In this guide we will go through the following steps.
- Build a containerized application using Cloud Build
- Set up GKE environments for Staging and Production
- Create the Kubernetes yaml mainfests for the Deployment and Service
- Write a Delivery Pipeline to deploy the application to GKE
- Trigger a new build and deployment to Staging after every successful build
Build a containerized application using Cloud Build
To begin we’re going to create a Hello World application and build it with Cloud Build. The generated container images will be pushed to Artifact Registry.
Create an application
For this demonstration we will use a Python Flask application, but you can use your go-to language if you prefer. If you’re following along with me, create main.py
in your project folder. Here is my trivial Hello…