Continuous Delivery with Jenkins in Kubernetes Engine

Set up a continuous delivery pipeline with Jenkins on Kubernetes engine. Jenkins is the go-to automation server used by developers who frequently integrate their code in a shared repository. The solution you'll build in this lab will be similar to the following diagram








  • Provision a Jenkins application into a Kubernetes Engine Cluster
  • Set up your Jenkins application using Helm Package Manager
  • Explore the features of a Jenkins application
  • Create and exercise a Jenkins pipeline

Task 1. Download the source code


gcloud config set compute/zone us-central1-c


Then copy the lab's sample code:

gsutil cp gs://spls/gsp051/continuous-deployment-on-kubernetes.zip .

unzip continuous-deployment-on-kubernetes.zip

cd continuous-deployment-on-kubernetes


Task 2. Provisioning Jenkins

Creating a Kubernetes cluster


gcloud container clusters create jenkins-cd \
--num-nodes 2 \
--machine-type n1-standard-2 \
--scopes "https://www.googleapis.com/auth/source.read_write,cloud-platform"


This step can take up to several minutes to complete. The extra scopes enable Jenkins to access Cloud Source Repositories and Google Container Registry.


student_04_105701c2c235@cloudshell:~ (qwiklabs-gcp-03-36d6decff90oject.7)$ gcloud container clusters list
NAME: jenkins-cd
LOCATION: us-central1-c
MASTER_VERSION: 1.27.2-gke.1200
MASTER_IP: 35.238.45.179
MACHINE_TYPE: n1-standard-2
NODE_VERSION: 1.27.2-gke.1200
NUM_NODES: 
STATUS: PROVISIONING

student_04_105701c2c235@cloudshell:~ (qwiklabs-gcp-03-36d6decff907)$ gcloud container clusters get-credentials jenkins-cd

Fetching cluster endpoint and auth data.
WARNING: cluster jenkins-cd is not RUNNING. The kubernetes API may or may not be available. Check the cluster status for more information.
kubeconfig entry generated for jenkins-cd.


student_04_105701c2c235@cloudshell:~ (qwiklabs-gcp-03-36d6decff907)$ kubectl cluster-info

Kubernetes control plane is running at https://35.238.45.179
GLBCDefaultBackend is running at https://35.238.45.179/api/v1/namespaces/kube-system/services/default-http-backend:http/proxy
KubeDNS is running at https://35.238.45.179/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Metrics-server is running at https://35.238.45.179/api/v1/namespaces/kube-system/services/https:metrics-server:/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
student_04_105701c2c235@cloudshell:~ (qwiklabs-gcp-03-36d6decff907)$ 



Task 3. Setup Helm

In this lab, you will use Helm to install Jenkins from the Charts repository. Helm is a package manager that makes it easy to configure and deploy Kubernetes applications. Once you have Jenkins installed, you'll be able to set up your CI/CD pipeline.


Add Helm's stable chart repo:

$ helm repo add jenkins https://charts.jenkins.io

Ensure the repo is up to date:

$ helm repo update

No comments:

Post a Comment

AppEngine - Python

tudent_04_347b5286260a@cloudshell:~/python-docs-samples/appengine/standard_python3/hello_world (qwiklabs-gcp-00-88834e0beca1)$ sudo apt upda...