Integrating Google Kubernetes Engine with Container Registry using CloudBuild!

Integrating Google Kubernetes Engine with Container Registry using CloudBuild!

No alt text provided for this image

Motive: To update your Kubernetes containers with the latest image and updated code using CI-CD (CloudBuild)

What is Google Kubernetes Engine?

Google Kubernetes Engine (GKE) is a management and orchestration system for Docker container and container clusters that run within Google's public cloud services. Google Kubernetes Engine is based on Kubernetes, Google's open-source container management system.

No alt text provided for this image

What is Container Registry?

Container Registry is a single place for your team to manage Docker images, perform vulnerability analysis, and decide who can access what with fine-grained access control. Existing CI/CD integrations let you set up fully automated Docker pipelines to get fast feedback.

No alt text provided for this image

What is CloudBuild?

Cloud Build is a managed service on Google Cloud Platform infrastructure that allows you to continuously build, test and deploy containers. Cloud Build lets you build software quickly across all languages. Cloud Build works across multiple environments such as VMs, serverless, Kubernetes, or Firebase

Flow Diagram

No alt text provided for this image

So basically, the scenario is like we have our deployment-ready and deployment is exposed using LoadBalancer and we need to update the image used by the pods through automation. So here comes the role of CloudBuild to create a trigger whenever changes are pushed by the developer the CloudBuild will run the trigger automatically and your container image will be updated! Now, Let's start with the practical!

Prerequisites :

  1. Kubernetes Cluster
  2. Push code in your Source Repository (Link in the end)
  3. Create one trigger such that attach your repo with the branch and whenever the changes is made the trigger is run.
  4. Create one deployment from the dockerfile in your GCR
  5. Expose your Deployment using LoadBalancer

Here's my cluster ready

No alt text provided for this image

Here's my deployment ready

No alt text provided for this image

And here's my deployment exposed service using LoadBalancer

No alt text provided for this image

So here the version is 1.0

No alt text provided for this image

Below is the output from the LoadBalancer IP

No alt text provided for this image

Now clone your repo in the terminal and add some changes in server.js file such that the version is now 2.0

No alt text provided for this image

Now I'm pushing these changes in source repo

No alt text provided for this image

You can refresh and see the changes in your source repo

No alt text provided for this image

You will now see that the trigger has been started automatically

No alt text provided for this image

My build has successfully run and what it has done is building a new Dockerfile , pushing the image to Container Registry(GCR) and terminating old running pods and launching new pods with the updated image

Now you can see the New deployed image with the updated version v2.0.

No alt text provided for this image

GitHub repo : https://github.com/mohak77/cicd-service.git

Thankyou! I hope it helps , open for suggestions.


Onkar Naik

DevOps @Forescout ?? | Google Champion Innovator | AWS | DevOps | 3X GCP | 1X Azure | 1X Terraform | Ansible | Kubernetes | SRE | Jenkins | Tech Blogger ??

3 年

Great bro Mohak Gund

要查看或添加评论,请登录

Mohak Gund的更多文章

  • Launching a WordPress site using AWS EC2 and connecting with AWS RDS(mySQL) as database

    Launching a WordPress site using AWS EC2 and connecting with AWS RDS(mySQL) as database

    ?? Create an AWS EC2 instance ?? Configure the instance with Apache Webserver. ?? Download php application name…

  • Launching HTTPD on Docker using Ansible

    Launching HTTPD on Docker using Ansible

    In this task we will be configuring our HTTPD server on Docker using Automation! First, I'm proving that in our managed…

    2 条评论
  • Configuring Hadoop cluster with Ansible

    Configuring Hadoop cluster with Ansible

    In this article, we will be automating the setup of Hadoop cluster using Ansible. Prerequisite setup requires Ansible…

    2 条评论
  • Hadoop and LVM

    Hadoop and LVM

    LVM : also known as Logical Volume Manager provides elasticity to increase or decrease size of the volume. Hadoop :…

    1 条评论
  • Configuring Webserver and Python interpreter over Docker container

    Configuring Webserver and Python interpreter over Docker container

    Welcome you all to my article based on TASK-7.2 of ARTH Task Description: Configuring HTTPD Server on Docker Container…

    2 条评论
  • National Strategy and AI

    National Strategy and AI

    What is Artificial Intelligence? AI might just be the single largest technology revolution of our live times, with the…

  • AWS - CLI

    AWS - CLI

    Hello connections ! This is the task performed in which I have configured an Amazon Linux EC2 instance and attach an…

  • Netflix on AWS

    Netflix on AWS

    What is Netflix ? Netflix is the world’s leading internet television network, with more than 100 million members in…

  • Big data

    Big data

    What is Big Data? Big data is a term that describes the large volume of data – both structured and unstructured – that…

  • Task 6

    Task 6

    Deploying WordPress application on K8S over minikube and RDS database on AWS. Hey connections, in this setup we have…

社区洞察

其他会员也浏览了