๐ CI/CD on Google Cloud in 2025: Deploy a Web App in 10 Minutes
Setting up a modern CI/CD pipeline on Google Cloud Platform (GCP) no longer takes days โ you can do it in minutes.
In this updated 2025 guide, Iโll walk you through deploying a web application using Cloud Build, Kubernetes, and Artifact Registry โ step by step.
By the end, youโll have a fully functional and auto-deploying system that reacts to code changes in GitHub and pushes them straight to production. Letโs go! ๐
โ
Prerequisites
Google Cloud account with billing enabled
GitHub account with a web app repo (or use a sample one)
Basic understanding of Docker and Kubernetes
gcloud CLI installed (optional but useful)
๐งฑ Step 1: Clone the Repository
You can use your own repo, but for demo purposes, feel free to clone this sample:
https://github.com/LF3551/gcp-webapp-cicd-example
Inside, you should see:
cloudbuild.yaml
โ defines the build processapp-deployment.yaml
โ Kubernetes deployment config
โ๏ธ Step 2: Create a Kubernetes Cluster (GKE)
Now that we have downloaded the repository, letโs proceed with setting up our Kubernetes cluster on Google Cloud Platform (GCP). Follow these steps:
Sign in to your Google Cloud Platform account.
Navigate to โKubernetesโ in the navigation menu.
Click on โCreate Cluster.โ
Specify a name (for example, โtest-clusterโ) and a region (for example, โus-central1โ).
Configure any other parameters or use the default values.
After clicking โCreate,โ wait for the cluster creation to complete. This process may take 15โ20 minutes. While the cluster is being created, we can proceed with other configurations.
๐ฆ Step 3: Set Up Artifact Registry
Now letโs proceed with creating an Artifact Registry:
Click on โCatalogโ in the navigation menu.
Enter โArtifact Registryโ in the search bar or find it in the list of services.
Click on โCreate Repository.โ
Specify the repository name (for example, โtest-repositoryโ) and choose the region (โus-central1โ).
Click on โCreateโ to complete the repository creation process.
6. Once the repository is created, navigate into it and copy the repository link.
For example, in my case with the project identifier โqwiklabs-gcp-00โ2ad8e3085b3bโ, the repository link would appear as follows:
โus-central1-docker.pkg.dev/qwiklabs-gcp-00โ2ad8e3085b3b/test-repositoryโ
7. Update the cloudbuild.yaml and app-deployment.yaml files by specifying the new repository link:
For app-deployment.yaml:
โus-central1-docker.pkg.dev/qwiklabs-gcp-00โ2ad8e3085b3b/test-repository/webapp:latestโ
For the cloudbuild.yaml file, in two places where the repository link is specified, use the following value:
โus-central1-docker.pkg.dev/qwiklabs-gcp-00โ2ad8e3085b3b/test-repository/webapp.โ
โ๏ธ Step 4: Update YAML Configs
Sign in to Google Cloud Console and navigate to โCloud Buildโ > โTriggersโ.
Click on the โCreate Triggerโ button.
Choose the source repository, such as your GitHub repository, and follow the instructions to connect your repository to Cloud Build.
Specify the branch in the trigger settings, for example, main or master, to which Cloud Build will respond.
Set a name for the trigger, for example, โpush-to-mainโ. By creating this trigger, you will configure automatic execution of the Cloud Build process when the specified branch of your repository is updated.
๐ Step 5: Create a Cloud Build Trigger
gcloud projects add-iam-policy-binding $(gcloud config get-value project) \ --member=serviceAccount:$(gcloud projects describe $(gcloud config get-value project) --format="value(projectNumber)")@cloudbuild.gserviceaccount.com \ --role=roles/container.developer
This command establishes a connection between your project in Google Cloud and the service account for Cloud Build. It provides the Cloud Build service account with the necessary permissions to work with containers and Kubernetes Engine in your project.
Step 6: Setting up kubectl for Cluster Interaction: After creating the cluster, follow these steps:
Open Cloud Shell on Google Cloud Platform.
Execute the command:
gcloud container clusters get-credentials <cluster_name> --zone <zone_name> --project <project_id>
In my example, it will be:
gcloud container clusters get-credentials test-cluster --zone us-central1 --project qwiklabs-gcp-00-2ad8e3085b3b
Now that kubectl setup is complete, you can execute Kubernetes commands, such as kubectl get pods
, directly in Cloud Shell to retrieve the list of pods in your cluster.
Step 7: After committing and pushing to the main (master) branch, follow these steps:
Check the Cloud Build execution result. Ensure that the build process was successful.
After successful build, verify the status of the pods. Make sure that the pods were created and started successfully.
Check the Kubernetes services. Copy the external IP address of the service and navigate to the link in your browser.
After navigating to the link, ensure that your website is successfully displayed.
As we wrap up this article, youโve successfully deployed your website using microservices on Google Cloud Platform. This process illustrates the principles of continuous delivery (CI/CD) and containerization for application deployment. Weโve covered each stage, from infrastructure setup to automated build and deployment, making your projects more scalable, reliable, and maintainable. By leveraging GCP tools, you now have access to robust infrastructure to develop and deploy your applications successfully. If you found this article helpful, please consider supporting me by giving it a like or star on GitHub. Your feedback will help other users discover the usefulness of this content. Thank you for your attention, and I hope the information has been valuable to you!
To connect with me or discuss this article further, feel free to reach out on LinkedIn.
#GoogleCloud, #CICD, #DevOps, #GCP, #CloudBuild.