AWS Cost  Optimization | DevOps Transformation

  • About Us
  • Services
    • AWS – Cloud – Optimization
    • AWS Well-Architected Framework
    • Cloud Migration Strategy
    • Cloud Native Developers
    • DevOps-Transformation
    • Digital Marketing
    • Disaster Recovery – Public Cloud
    • Managed Cloud Services
    • Web Application Firewall
    • Web Development
  • Industries
    • Automotive, Transportation, and Logistics
    • Consumer Goods
    • Education
    • Financial Services
    • Food & Beverages
    • Information Technology
    • Manufacturing
    • Media & Entertainment
    • Oil & Gas
  • Blogs
  • Contact
REQUEST A QUOTE

Creating a CI/CD pipeline for GKE using CloudBuild and Spinnaker

CI/CD pipeline
Friday, 23 October 2020 / Published in Cloud Migration Strategy

Creating a CI/CD pipeline for GKE using CloudBuild and Spinnaker

Welcome to the next-gen service of the creation of CI/CD pipeline using the option of Google Kubernetes Engine (GKE), Cloud Source Repositories, Cloud Build, and Spinnaker for Google cloud. Today in this blog we would be sharing the details about how to create CI/CD pipeline for making the work easier and simpler.

It is the process in which once the sample app is created, the team can configure these services automatically along with its testing as well as deploying services too. When you modify the app code, the changes trigger the continuous delivery pipeline to automatically rebuild, retest, and redeploy the new version.

The State of DevOps reports identified capabilities that drive software delivery performance. This tutorial will help you with the following capabilities:

  • Continuous delivery
  • Deployment automation
  • Streamlining change approval

Pipeline architecture

To continuously deliver the updates on the app to the user, it is necessary that you need an automated process that is very much reliable in terms of builds, tests, and update your software timely. If the codes are changed, the same should automatically flow through a pipeline that includes artifact creation, unit testing, functional testing, and production rollout.

There come some cases, where you want to have a code that can only be applied to a subset of your users, so is that it is been excercised realistically before you getting it pushed into your entire user base. If one of these canary releases proves unsatisfactory, your automated procedure must be able to quickly roll back the software changes.

With GKE and Spinnaker, you can create a robust continuous delivery flow that helps to ensure your software is shipped as quickly as it is developed and validated. Although rapid iteration is your end goal, you must first ensure that each app revision passes through a series of automated validations before becoming a candidate for production rollout. When a given change has been vetted through automation, you can also validate the app manually and conduct further prerelease testing.

After your team decides the app is ready for production, one of your team members can approve it for production deployment.

App delivery pipeline

The high-level steps of this pipeline are as follows:

  • A developer changes code and pushes it to a repository.
  • Cloud Build detects the changes, builds the Docker image, tests the image, and pushes the image to Spinnaker.
  • Spinnaker detects the image, deploys image to Canary, and tests the Canary deployment. After a manual approval, Spinnaker deploys the image to production.

Deploy Spinnaker for Google Cloud using Cloud Shell

Run all the terminal commands in this tutorial from Cloud Shell.

With Spinnaker for Google Cloud, you can set up and manage Spinnaker in a production-ready configuration, optimized for Google Cloud. Spinnaker for Google Cloud sets up resources (GKE, Memorystore, Cloud Storage buckets and service accounts), integrates Spinnaker with related services such as Cloud Build, and provides a Cloud Shell-based management environment for your Spinnaker installations, with helpers and common tools such as spin and hal.

  • Open Spinnaker for Google Cloud in Cloud Shell. This clones the Spinnaker for Google Cloud repository into your Cloud Shell environment and launches the detailed installation instructions.

GO TO CLOUD SHELL

  • Configure Git. If you’ve configured Git before, you can skip this step.

git config –global user.email “EMAIL_ADDRESS”

git config –global user.name “USERNAME

  • Set an environment variable to define which Cloud project to install Spinnaker to:

DEVSHELL_PROJECT_ID=YOUR_PROJECT_ID

Replace YOUR_PROJECT_ID with the project that you selected or created for this

  • Install Spinnaker for Google Cloud.

PROJECT_ID=${DEVSHELL_PROJECT_ID} ~/cloudshell_open/spinnaker-for-gcp/scripts/install/setup_properties.sh

~/cloudshell_open/spinnaker-for-gcp/scripts/install/setup.sh

  • Restart Cloud Shell to load new environment settings
  • Connect to Spinnaker.
    ~/cloudshell_open/spinnaker-for-gcp/scripts/manage/connect_unsecured.sh
  • In Cloud Shell, click the Web Preview icon and select Preview on port 8080.

Create a GKE cluster for application deployments

A common pattern is to have a GKE cluster used for builds, deployments, and so on, and then other GKE clusters for running applications. In this section you create another GKE cluster, app-cluster, to deploy the sample application to.

  • In Cloud Shell, create a new GKE cluster:

ZONE=us-east1-c

gcloud config set compute/zone $ZONE

gcloud container clusters create app-cluster \

–machine-type=n1-standard-2

  • Add the new GKE cluster to Spinnaker. The default values should be correct.

~/cloudshell_open/spinnaker-for-gcp/scripts/manage/add_gke_account.sh

Example output and values:

  • Please enter the context you wish to use to manage your GKE resources: gke_spinnaker-246920_us-east1-c_app-cluster
  • Please enter the id of the project within which the referenced cluster lives: spinnaker-246920
  • Please enter a name for the new Spinnaker account: app-cluster-acct

Change the kubernetes context back to your Spinnaker cluster:

kubectl config use-context gke_${DEVSHELL_PROJECT_ID}_${ZONE}_spinnaker-1

Push and apply the configuration changes to Spinnaker:

~/cloudshell_open/spinnaker-for-gcp/scripts/manage/push_and_apply.sh

Building the Docker image

In this section, you configure Cloud Build to detect changes to your app source code, build a Docker image, and then push it to Container Registry.

Create your source code repository

  • In Cloud Shell, download the sample source code:

cd ~

wget https://gke-spinnaker.storage.googleapis.com/sample-app-v4.tgz\

  • Unpack the source code:

tar xzfv sample-app-v4.tgz

  • Change directories to the source code:

cd sample-app

  • Make the initial commit to your source code repository:

git init

git add .

git commit -m “Initial commit”

  • Create a repository to host your code:

gcloud source repos create sample-app

git config credential.helper gcloud.sh

  • Add your newly created repository as remote:

export PROJECT=$(gcloud info –format=’value(config.project)’)

git remote add origin https://source.developers.google.com/p/$PROJECT/r/sample-app

  • Push your code to the new repository’s master branch:

git push origin master

  • Check that you can see your source code in the console:

GO TO THE SOURCE CODE PAGE

Conclusion:
On reading this blog, it would be very much clear that what code is required for getting the integration work done. To know more connect with us today as you are just a phone call and an email away from us.Contact us today !!

.

Tagged under: aws, CI/CD pipeline, Cloud, CloudBuild, cloudservices, Spinnaker

What you can read next

Creating a CI/CD pipeline for GKE using CloudBuild and Spinnaker
Cloud Migration Strategy with CloudStackGroup
cloud migration
Strategies and Process of Migrating Applications to the Cloud

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search for posts

Loading

Recent Posts

  • What is Future of DevOps in 2022

    0 comments
  • DevOps tools and software :-Increase DevOps agility, shorten releases, improve reliability and stay ahead of the competition with DevOps tools

    0 comments
  • 4 Major Benefits of Using Kubernetes

    0 comments

Recent Comments

  • New York Consultants on Jenkins on Kubernetes Engine – Cloud Stack Group
  • Parbriz auto OPEL ASCONA C Hatchback J82 1981 on Strategies and Process of Migrating Applications to the Cloud
  • Geam Porsche Cayenne 9PA 2010 on Strategies and Process of Migrating Applications to the Cloud

Add Wings to the Modern Enterprise with the help of a Global Cloud Platform

The platform of Cloud Stack Group provides numerous options that are beneficial to the organisation. It is necessary that we follow all the process as we share the result that is scalable, accurate and convenient to use.

GET A QUOTE

Cloud Stack Group is the pioneered and well-established company that is working on the newest and the latest forms of AWS services. Being in a competitive market for more than 3+ years we have served with our services to more than 40 industries and 50+ fortune global companies

MENU

  • About Us
  • Services
  • Industries
  • Blogs
  • Contact

OUR BLOGS

VIEW ALL
  • What is Future of DevOps in 2022

  • DevOps tools and software :-Increase DevOps agility, shorten releases, improve reliability and stay ahead of the competition with DevOps tools

  • 4 Major Benefits of Using Kubernetes

COMPANY INFO

+91 9687177221

info@cloudstackgroup.com

WE'RE SOCIAL

SUBSCRIBE NOW

Loading

© 2019-2022 CLOUDSTACKGROUP. ALL RIGHTS RESERVED

A SADADIYA INDUSTRIES LLP COMPANY

TOP