Skip to main content

Implementing a Full CI/CD Pipeline

Course

Intro Video

Photo of Will Boyd

Will Boyd

DevOps Team Lead in Content

Length

22:55:22

Difficulty

Intermediate

Videos

45

Hands-on Labs

14

Quizzes/Exams

4

Course Details

The CI/CD Pipeline has become an integral part of DevOps culture. There are a variety of tools and techniques for implementing such a pipeline. This course will provide you with a hands-on experience of building out a CI/CD pipeline from start to finish. It begins with source control management and ends with a a fully-orchestrated pipeline using Jenkins and Kubernetes, complete with self-healing, autoscaling, and canary testing functionality.

Syllabus

Introduction

About the Course Author

00:00:27

Lesson Description:

This video introduces Will Boyd, the author of the course.

Course Features and Tools

00:03:28

Lesson Description:

This video will introduce you to some of the features and tools that are available to aid your learning as you proceed through this course.

Introduction to Implementing a Full CI/CD Pipeline

00:10:15

Lesson Description:

This video introduces the course and provides a brief overview of the content that will be covered in the course.

Source Control Management

Introduction to SCM

00:05:04

Lesson Description:

SCM is a vital part of any CI/CD pipeline, and in many ways it is the first step. Anyone who wants to build or maintain a CI/CD pipeline needs a basic understanding of SCM. Git is the most widely used SCM today. This video will introduce you to the relationship between SCM and CI/CD, and give you an overview of some of the topics that will covered in more detail in this section. After completing this lesson, you should be prepared to learn the basics of installing and using git.

Installing Git

00:06:17

Lesson Description:

Before you can begin using git, you need to install and configure it. This lesson will walk you through everything that needs to be done in order to install and configure git, and it will also demonstrate each step. After completing this lesson, you should be able to install and configure git so that it can authenticate with GitHub.com. You can find additional documentation on these topics in the following locations: Git installation instructions: https://git-scm.com/downloads . GitHub ssh authentication setup documentation:https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/ https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/

Creating GitHub Forks

00:03:02

Lesson Description:

Forks are a useful tool for working with GitHub projects. Forks provide a way for any user to create their own personal copy of a GitHub repository which they can fully control without interfering with other users. They are widely used in managing open source projects, and they will be used frequently in this course. In this lesson, you will learn how to create a fork of a GitHub repository. If you want to follow along, the repository used to create a fork in this lesson's demonstration can be found here: https://github.com/linuxacademy/cicd-pipeline-train-schedule-git

Making Changes in Git

00:10:11

Lesson Description:

A crucial part of using git in any CI/CD Pipeline is making code changes. In order to manage changes to source code in git, you need to know how to clone a remote repository, stage changes to source code files, commit them, and push them back to the remote repo. This lesson will introduce you to a few basic commands that you can use to do this, and it will provide you with a demonstration of their usage. After completing this lesson, you should be able to make changes to source code controlled in git, commit them, and push them to GitHub. If you want to follow along, you can make a personal fork of the source code repo at https://github.com/linuxacademy/cicd-pipeline-train-schedule-git. Just go to that repo in GitHub and click "fork." Then, when you clone the repo, clone your personal fork with following command (replace with your actual github username):

git clone git@github.com:/cicd-pipeline-train-schedule-git.git

Branches and Tags

00:06:15

Lesson Description:

Git branches and tags often play a role in CI/CD automation. You will need a basic understanding of these concepts in order to proceed with later steps of implementing a CI/CD Pipeline. This lesson provides a brief introduction to git branches and tags. After completing it, you should have a basic understanding of what tags and branches are in git.

Pull Requests

00:03:53

Lesson Description:

Pull requests often play an important role in a CI/CD workflow. This lesson introduces the concept of pull requests and demonstrates how to create and merge a pull request on GitHub. After completing this lesson, you should have a basic understanding of pull requests that will be useful as you proceed in implementing a CI/CD pipeline.

QUIZ: Source Control Management

00:15:00

Hands-on Labs are real live environments that put you in a real scenario to practice what you have learned without any other extra charge or account to manage.

00:45:00

Build Automation

Introducing Build Automation

00:02:52

Lesson Description:

Once you have implemented an SCM solution, the next step in building a CI/CD Pipeline is build automation. This lesson will introduce the topic of build automation and will introduce gradle, the tool which will be used to implement build automation in this course. After completing this lesson, you should have a basic understanding of the role of build automation in a CI/CD pipeline, and you should be ready to begin learning how to implement a Gradle build for the train schedule app. Get more information on Gradle at https://gradle.org/

Installing Gradle

00:10:52

Lesson Description:

Before you can begin using Gradle to create build automation, you need to be able to install it. This lesson will walk you through the process of installing Gradle. It will also introduce you to a slightly more advanced way of installing and using Gradle, known as the Gradle Wrapper. After completing this lesson, you should be able to install Gradle and the Gradle Wrapper so that you can execute Gradle builds. You can find more information about installing Gradle at https://gradle.org/install/ Here are the commands used in the demo to install gradle:

cd ~/
wget -O ~/gradle-4.7-bin.zip https://services.gradle.org/distributions/gradle-4.7-bin.zip
sudo yum -y install unzip java-1.8.0-openjdk
sudo mkdir /opt/gradle
sudo unzip -d /opt/gradle/ ~/gradle-4.7-bin.zip
sudo vi /etc/profile.d/gradle.sh
Put this text into gradle.sh:
export PATH=$PATH:/opt/gradle/gradle-4.7/bin
Then set permissions on gradle.sh:
sudo chmod 755 /etc/profile.d/gradle.sh
Finally, after logging out of the server and logging back in:
gradle --version
And the commands used to install and run the Gradle Wrapper:
cd ~/
mkdir my-project
cd my-project
gradle wrapper
./gradlew build

Gradle Basics

00:09:36

Lesson Description:

Gradle is a powerful build automation tool, but in order to use it you need to know the basics of how it works. This lesson will guide you through the core concepts of Gradle automation, and it will demonstrate creating a simple build.gradle file. After completing this lesson, you should have a basic working knowledge of how to implement and execute tasks in Gradle. More more information on Gradle, check out the official Gradle site: https://gradle.org Here is the final build.gradle from the demo:

plugins {
  id 'com.moowork.node' version '1.2.0'
}

task sayHello  {
  doLast {
    println 'Hello, World!'
  }
}

task anotherTask  {
  doLast {
    println 'This is another task'
  }
}
If you have the gradle wrapper installed in your project (for example, by using gradle init), you can run the build defined in this build.gradle like so:
./gradlew sayHello

Automated Testing

00:05:21

Lesson Description:

Automated testing is a very important component of a CI/CD Pipeline, and it is often performed using build automation. This lesson introduces the concept of automated testing and covers a few different types of automated tests. It also discusses the basics of executing automated tests in Gradle and demonstrates what that can look like. After completing this lesson, you will have a foundational understanding of automated tests that will allow you to incorporate them into the CI/CD Pipeline. The sample project used in the demo for the lesson can be found on the example-solution branch of this GitHub repo: https://github.com/linuxacademy/cicd-pipeline-train-schedule-gradle

QUIZ: Build Automation

00:15:00

Hands-on Labs are real live environments that put you in a real scenario to practice what you have learned without any other extra charge or account to manage.

00:45:00

Continuous Integration

CI Overview

00:04:15

Lesson Description:

Continuous Integration is an essential component of a full CI/CD Pipeline. This lesson will briefly discuss what CI is, and it will introduce the CI tools that will be used in this course: Jenkins. After completing this lesson, you will be ready to begin learning how to implement CI using Jenkins. For more information on Jenkins, check out the official Jenkins site: https://jenkins.io/

Installing Jenkins

00:06:34

Lesson Description:

In order to use Jenkins as part of a CI/CD solution, you must first know how to install it. This lesson will take you through the steps necessary in order to install Jenkins and prepare it for use in a CI process. It provides a demonstration of installing Jenkins on a CentOS environment using yum. After completing this lesson, you should be able to perform a Jenkins installation yourself. Jenkins installation docs: https://jenkins.io/doc/book/installing/ Jenkins wiki on installing Jenkins in a CentOS environment: https://wiki.jenkins.io/display/JENKINS/Installing+Jenkins+on+Red+Hat+distributions Here are the commands used to install Jenkins in the demonstration: Note: It is recommended to use Jenkins version 2.164.2, since some of the default plugins are no longer compatible with 2.121.1.

sudo yum -y remove java
sudo yum -y install java-1.8.0-openjdk
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
sudo yum -y install jenkins-2.164.2
sudo systemctl enable jenkins
sudo systemctl start jenkins

Setting up Jenkins Projects

00:06:57

Lesson Description:

Jenkins projects are at the core of doing any kind of automation in Jenkins. The CI process for an application is generally configured in Jenkins as a Jenkins project. This lesson will introduce the concept of Jenkins projects. It will also demonstrate how to set up a freestyle project that pulls application source code from GitHub and executes build automation against it. After completing this lesson, you will know how to configure a simple freestyle project in Jenkins. If you want to follow along, here is the source code for the train-schedule application used in the demo: https://github.com/linuxacademy/cicd-pipeline-train-schedule-jenkins

Triggering Builds with Git Hooks

00:09:54

Lesson Description:

One of the most important aspects of a good CI process is quick feedback whenever there is a change. This means that it is important to execute builds as soon as possible after a code change is pushed to source control. One of the best ways to do this with GitHub and Jenkins is to use webhooks to have GitHub notify Jenkins when there is a change so that Jenkins can automatically start the build. This lesson will demonstrate how to configure webhooks from GitHub to Jenkins. After completing the lesson, you should be able to configure Jenkins to automatically execute a build whenever there is a code change in GitHub. If you want to follow along, here is the source code for the train schedule application used in the demo: https://github.com/linuxacademy/cicd-pipeline-train-schedule-jenkins

QUIZ: Continuous Integration

00:15:00

Hands-on Labs are real live environments that put you in a real scenario to practice what you have learned without any other extra charge or account to manage.

00:45:00

Hands-on Labs are real live environments that put you in a real scenario to practice what you have learned without any other extra charge or account to manage.

00:45:00

Continuous Delivery

Introducing Jenkins Pipelines

00:06:22

Lesson Description:

Jenkins is a great CI tool, but it is also powerful component of continuous deployment. Jenkins Pipelines is a suite of official Jenkins plugins which support CD functionality. This lesson introduces Jenkins Pipelines and gives a quick overview of what it looks like to create and execute a pipeline. After completing this lesson, you should have a basic understanding of what Jenkins Pipelines is, and you should be ready to begin learning how to implement one. For more information on Jenkins Pipelines, check out the official documentation: https://jenkins.io/doc/book/pipeline/

Jenkins Pipeline Stages and Steps

00:05:41

Lesson Description:

The basic structure of a Jenkins pipeline consists of stages and steps. You need to be familiar with these concepts in order to build your own Jenkins pipelines. This lesson discusses these two concepts and walks you through a sample Jenkinsfile that uses a stage and a few steps to implement a CI build. After completing this lesson, you will be ready to proceed toward implementing more complex functionality within a Jenkins pipeline. When building Jenkins pipelines, you may need to consult the steps reference: https://jenkins.io/doc/pipeline/steps/ Feel free to check out the sample Jenkinsfile used in the demo for this lesson: https://github.com/linuxacademy/cicd-pipeline-train-schedule-pipelines/blob/example-solution/Jenkinsfile

Deployment with Jenkins Pipelines

00:21:51

Lesson Description:

In order to succeed with continuous delivery and continuous deployment, deployment automation is essential. In this lesson, we will be implementing automated deployments within a Jenkins pipeline. We will create pipeline stages to automatically deploy to a staging server and a production server. After completing this lesson, you will have some familiarity with how automated deployment can be implementing using Jenkins Pipelines. Check out the pipeline steps reference for the Publish Over SSH plugin used in the demo: https://jenkins.io/doc/pipeline/steps/publish-over-ssh/ Here is the sample source code used in the demo. Check the example-solution branch for the complete Jenkinsfile: https://github.com/linuxacademy/cicd-pipeline-train-schedule-cd

QUIZ: Continuous Delivery

00:15:00

Hands-on Labs are real live environments that put you in a real scenario to practice what you have learned without any other extra charge or account to manage.

01:00:00

Hands-on Labs are real live environments that put you in a real scenario to practice what you have learned without any other extra charge or account to manage.

01:30:00

Containers

Why Containers?

00:06:46

Lesson Description:

An important step in the journey toward a full CI/CD Pipeline is containerization. Containers make it easier to implement some of the automation features involved in orchestration. In this lesson, we will discuss what containers are and why we want to use them in the context of a CI/CD Pipeline. We will also introduce Docker, the container tool of choice for this course. Feel free to check out Docker's own overview of the Docker technology: https://www.docker.com/what-docker

Installing Docker

00:02:02

Lesson Description:

In order to begin using Docker, you need to know how to install it. This lesson will guide you through the process of installing Docker within a CentOS 7 environment. After completing this lesson, you should have an understanding of how to install Docker. If you want more information, or you want to know how to install Docker in a non-CentOS 7 environment, be sure to check out the official Docker install documentation: https://docs.docker.com/install/

Docker Basics

00:09:14

Lesson Description:

In order to utilize Docker within the context of a CI/CD Pipeline, you need some basic knowledge of its concepts and how it is used. In this lesson, we will cover some of the essential concepts of Docker, such as images, containers, and registries. We will also demonstrate a few of the common commands that you will use to interact with Docker. After completing this lesson, you will know how to build a Docker image and publish it to Docker Hub. You will also know how to run a container using a Docker image. For more information, check out Docker's official getting started guide: https://docs.docker.com/get-started/ Here are the contents of the Dockerfile that was used for this lesson's demo:

FROM ubuntu
CMD ["/bin/bash", "-c", "while true; do echo Hello; sleep 1; done"]

Building a Dockerfile

00:08:25

Lesson Description:

The next step in your CI/CD journey is to learn how to create a Dockerfile. Dockerfiles allow you to create your own Docker images to run applications. This lesson will discuss the basics of Dockerfiles and demonstrate how to dockerize the Train Schedule app. After completing this lesson, you will have a basic understanding of how to build a Dockerfile that can be used to create a Docker image and run Docker containers. For more information on Dockerfiles, check out the official Dockerfile reference: https://docs.docker.com/engine/reference/builder/ Here is the Train Schedule application source code that was forked for the demo: https://github.com/linuxacademy/cicd-pipeline-train-schedule-docker Here are the contents of the Dockerfile that that was created in the demo:

FROM node:carbon
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 8080
CMD ["npm", "start"]

Running with Docker in Production

00:01:49

Lesson Description:

It's great to know how to containerize applications, but what does it look like to run a container in production? This lesson will give you some insight into the basics of what running Docker containers in production can look like. This will provide you with the understanding necessary to automate the deployment of a dockerized app as part of a CD pipeline.

Installing Docker on Jenkins

00:02:22

Lesson Description:

In order to deploy a containerized app, Jenkins needs to be able to interact with Docker. This means that Docker needs to be installed locally on the Jenkins server, and the Jenkins user needs to be provided with the permissions necessary to use that Docker installation. This lesson demonstrates how to install Docker on a Jenkins server and configure the Jenkins user to be able to access it. Here are the commands used in the demo for this lesson:

sudo yum -y install docker
sudo systemctl start docker
sudo systemctl enable docker
sudo groupadd docker
sudo usermod -aG docker jenkins
sudo systemctl restart jenkins
sudo systemctl restart docker

Jenkins Pipelines CD and a Dockerized App

00:10:48

Lesson Description:

So far, you have learned how to implement a deployment of an app directly to a server using a Jenkine Pipeline. Now that you have learned how to dockerize the app, it is time to dockerize the CD process as well. This lesson will discuss one way we can configure a Jenkins pipeline to deploy a dockerized app as a contained. This lesson demonstrates how to build a Jenkins pipeline that builds the app as a Docker image, puhes the image to a registry, pulls the image to the production server, and deploys the app as a container on the production server. After completing this lesson, you will be able to apply the concepts of Jenkins pipeline automation to a dockerized app. You can find the source code of the train-schedule app here: https://github.com/linuxacademy/cicd-pipeline-train-schedule-dockerdeploy And you can find the final version of the Jenkinsfile from the demo on the example-solution branch of that project here: https://github.com/linuxacademy/cicd-pipeline-train-schedule-dockerdeploy/blob/example-solution/Jenkinsfile

Hands-on Labs are real live environments that put you in a real scenario to practice what you have learned without any other extra charge or account to manage.

00:45:00

Hands-on Labs are real live environments that put you in a real scenario to practice what you have learned without any other extra charge or account to manage.

01:30:00

Orchestration

Orchestration

00:03:33

Lesson Description:

Now that we have explored the implementation of CI and automated deployment, we are ready to start thinking about deploying frequently. But in order to provide stability in the context of this high rate of change, we need robust tools for managing our infrastructure. This lesson introduces orchestration and how we can use it in the context of a CI/CD Pipeline. It also introduces Kubernetes, the orchestration tool we will be using in this course. After completing this lesson, you will have an understanding of what what we are trying to accomplish by deploying our application to Kubernetes and why that is important. Be sure to check out kubernetes.io for more information on Kubernetes!

Creating a Kubernetes Cluster

00:10:52

Lesson Description:

In order to use Kubernetes, you need to create a Kubernetes cluster. This lesson discusses how to do this and demonstrates setting up a simple cluster with one master and one node using kubeadm. After completing this lesson, you will be able to create a simple Kubernetes cluster that you can deploy applications to. You can find instructions on various ways of installing Kubernetes here: https://kubernetes.io/docs/setup/ Installation instructions specific to kubeadm can he found here: https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/ You can initialize the master node in kubeadm by creating a config file called kube-config.yml with these contents:

apiVersion: kubeadm.k8s.io/v1alpha3
kind: ClusterConfiguration
networking:
  podSubnet: 10.244.0.0/16
apiServerExtraArgs:
  service-node-port-range: 8000-31274
Then run this command referencing that file:
kubeadm init --config kube-config.yml
Use this command to set up a pod network after initializing the master with kubeadm init:
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/bc79dd1505b0c8681ece4de4c0d86c5cd2643275/Documentation/kube-flannel.yml

Kubernetes Basics

00:08:25

Lesson Description:

In order to use Kubernetes in the context of a CI/CD Pipeline, it is important to understand tha basics of how Kubernetes works and what it does. In this lesson, we will discuss some of the essential Kubernetes terminology, such as clusters, master, nodes, pods, and services. We will also discuss Kubernetes deployments and how they can help us to achieve stability when doing continuous deployment. You can find more detailed documentation on some of the concepts discussed in this lesson here: https://kubernetes.io/docs/concepts/#kubernetes-objects

Deploying to Kubernetes with Jenkins

00:15:46

Lesson Description:

Now that we have learned the basics of setting up and using a Kubernetes cluster, we are ready to integrate that knowledge with the CD process we have built using Jenkins Pipelines. In this lesson, you will learn how to deploy a Dockerized application to a Kubernetes cluster as part of a Jenkins Pipelines CD process. This demonstration uses the Kubernetes Continuous Deploy plugin to deploy to Kubernetes from Jenkins. You can find additional documentation about that plugin here: https://jenkins.io/doc/pipeline/steps/kubernetes-cd. If you want to follow along, you can find the sample source code here: https://github.com/linuxacademy/cicd-pipeline-train-schedule-kubernetes. Be sure to check out the example solution branch for the code that was used to complete the demo.

Hands-on Labs are real live environments that put you in a real scenario to practice what you have learned without any other extra charge or account to manage.

01:30:00

Monitoring

Monitoring

00:05:06

Lesson Description:

In order to manage the complexity of a system that is able to support a CI/CD process, it is critical to have visibility into that system. Monitoring tools provide access to important data that can help you maintain stability in the context of a high rate of change. This lesson introduces the concept of monitoring and gives you a basic understanding of its goals. It also introduces Prometheus and Grafana, the two monitoring tools that will be used in this course. For more information about these monitoring tools, check out their official sites: Prometheus - https://prometheus.io/ Grafana - https://grafana.com/

Installing Prometheus and Grafana

00:14:10

Lesson Description:

The first step toward using Prometheus and Grafana to gather metrics within Kubernetes is to install them. This video walks you through the process of installing Prometheus and Grafana in your Kubernetes cluster. After completing this lesson, you will know how to quickly install Prometheus and Grafana using Helm. Since there are quite a few commands involved in this installation, here is a reference guide for the commands used to perform the installation in this lesson:

curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > /tmp/get_helm.sh
chmod 700 /tmp/get_helm.sh
DESIRED_VERSION=v2.8.2 /tmp/get_helm.sh
helm init --wait
kubectl --namespace=kube-system create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default
helm ls
cd ~/
git clone https://github.com/kubernetes/charts
cd charts
git checkout efdcffe0b6973111ec6e5e83136ea74cdbe6527d
cd ../
vi prometheus-values.yml
prometheus-values.yml:
alertmanager:
    persistentVolume:
        enabled: false
server:
    persistentVolume:
        enabled: false
Then run:
helm install -f prometheus-values.yml charts/stable/prometheus --name prometheus --namespace prometheus
vi grafana-values.yml
grafana-values.yml:
adminPassword: password
Then run:
helm install -f grafana-values.yml charts/stable/grafana/ --name grafana --namespace grafana
vi grafana-ext.yml
grafana-ext.yml:
kind: Service
apiVersion: v1
metadata:
  namespace: grafana
  name: grafana-ext
spec:
  type: NodePort
  selector:
    app: grafana
  ports:
  - protocol: TCP
    port: 3000
    nodePort: 8080
Then run:
kubectl apply -f grafana-ext.yml
You can check on the status of the prometheus and grafana pods with these commands:
kubectl get pods -n prometheus
kubectl get pods -n grafana
When setting up your dastasource in grafana, use this url:
http://prometheus-server.prometheus.svc.cluster.local

Cluster Monitoring

00:04:27

Lesson Description:

One of the important ways that monitoring can help you maintain stability in the context of Kubernetes is monitoring of the Kubernetes cluster itself. Fortunately, there is a ready-made community dashboard that can be easily imported into your grafana installation to quickly get some insight into the performance and stability of your cluster. In this lesson, you will learn how to import the Kubernetes All Nodes community dashboard in order to set up cluster monitoring for your Kubernetes cluster. You can find additional community dashboards here: https://grafana.com/dashboards Check here for more info on the Kubernetes All Nodes dashboard: https://grafana.com/dashboards/3131

Application Monitoring

00:10:43

Lesson Description:

In additional to monitoring the health of your cluster, it is also important to monitor metrics about the applications themselves. This video discusses the basics of what it takes to get metric data from applications into Prometheus, as well as how to build custom Grafana dasboards on top of that data. Here is the sample source code for the train schedule app that was used in the demo: https://github.com/linuxacademy/cicd-pipeline-train-schedule-monitoring And here is a direct link to the Kubernetes template yml file that was used to deploy the app: https://github.com/linuxacademy/cicd-pipeline-train-schedule-monitoring/blob/master/train-schedule-kube.yml Metrics Query: sum(rate(http_request_duration_ms_count[2m])) by (service, route, method, code)

Alerting

00:06:12

Lesson Description:

While monitoring is a powerful way to gain insight into applications and infrastructure, alerts provide the ability to act on that information immediately when problems arise. This lesson will show you what it looks like to set up alerts in Grafana using data from your dashboards. After completing this lesson, you will have a basic understanding of what is involved in setting up Grafana alerts. Check out the Grafana documentation on alerting for more info: http://docs.grafana.org/alerting/rules/.

Hands-on Labs are real live environments that put you in a real scenario to practice what you have learned without any other extra charge or account to manage.

01:30:00

Self-Healing

Kubernetes and Self-Healing

00:05:46

Lesson Description:

Robust, stable systems are crucial to a quality CI/CD pipeline. One powerful way to increase stability using Kubernetes is to use self-healing. This lesson introduces the concept of self-healing and demonstrates some of the self-healing features that Kubernetes provides out-of-the-box in its management of container state. After completing this lesson, you will have a basic understanding of how Kubernetes manages container state, which will serve as a foundation for implementing more sophisticated self-healing functionality. For more information, check out the Kubernetes documentation on pod lifecycle and restart policies: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy.

Creating Liveness Probes in Kubernetes

00:09:47

Lesson Description:

Although Kubernetes is able to automatically restart containers by default if their main processes crash, sometimes more sophisticated error detection is needed in order to take full advantage of self-healing functionality. In this lesson, you will learn how to implement a basic liveness probe in Kubernetes that will periodically verify that the application is responding correctly to requests. After completing this lesson, you will have a basic understanding of what liveness probes can do and how to implement them. For more information on Kubernetes liveness probes, check out their documentation: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/. Here is the final Kubernetes template file used in the demo (train-schedule-kube.yml):

kind: Service
apiVersion: v1
metadata:
  name: train-schedule-service
  annotations:
    prometheus.io/scrape: 'true'
spec:
  type: NodePort
  selector:
    app: train-schedule
  ports:
  - protocol: TCP
    port: 8080
    nodePort: 8080

---

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: train-schedule-deployment
  labels:
    app: train-schedule
spec:
  replicas: 2
  selector:
    matchLabels:
      app: train-schedule
  template:
    metadata:
      labels:
        app: train-schedule
    spec:
      containers:
      - name: train-schedule
        image: linuxacademycontent/train-schedule:selfhealing
        ports:
        - containerPort: 8080
        livenessProbe:
          httpGet:
            path: /
            port: 8080
          initialDelaySeconds: 15
          timeoutSeconds: 1
          periodSeconds: 10
You can find the sample source code here: https://github.com/linuxacademy/cicd-pipeline-train-schedule-selfhealing

Hands-on Labs are real live environments that put you in a real scenario to practice what you have learned without any other extra charge or account to manage.

01:30:00

Autoscaling

Kubernetes and Autoscaling

00:03:30

Lesson Description:

One of the most powerful benefits of orchestration tools like Kubernetes is the ability to automatically scale resources in response to real-time metrics. Autoscaling provides a great way to increase stability and conserve costs in the context of the CI/CD Pipeline. In this lesson, you will learn what autoscaling is and, at a high level, how it can be done in Kuberetes. This will prepare you for the next lesson, which will demonstrate implementing these concepts.

Horizontal Pod Autoscalers in Kubernetes

00:17:57

Lesson Description:

Kubernetes provides some powerful tools for doing autoscaling. A horizontal pod autoscaler (HPA) is one way to implement pod scaling based upon a variety of metrics. This lesson demonstrates how to implement a simple horizontal pod autoscaler within a Kubernetes cluster. Be sure to check out the full HPA documentation: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ Here is the GitHub repo for the source code used in the demo. Check the example-solution branch for the demo's final state: https://github.com/linuxacademy/cicd-pipeline-train-schedule-autoscaling Here are the commands used to set up the autoscaler in the demo:

cd ~/
git clone https://github.com/kubernetes-incubator/metrics-server.git
cd metrics-server/
kubectl create -f deploy/1.8+/
kubectl get --raw /apis/metrics.k8s.io/
cd ~/
git clone 
cd cicd-pipeline-train-schedule-autoscaling/
vi train-schedule-kube.yml
kubectl apply -f train-schedule-kube.yml
You can find the changes made to train-schedule-kube.yml in the example-solution branch of the GitHub repo. Once you have deployed the app and the HPA, you can generate CPU load to test it by spinning up a busybox shell:
kubectl run -i --tty load-generator --image=busybox /bin/sh
Then run this in the busybox shell to create load:
while true; do wget -q -O- http://:8080/generate-cpu-load; done

Hands-on Labs are real live environments that put you in a real scenario to practice what you have learned without any other extra charge or account to manage.

01:30:00

Canary Testing

What is Canary Testing?

00:03:49

Lesson Description:

Canary testing can be a great way to build confidence in your CI/CD pipeline. It offers a way to examine the performance of new code under real-world usage while minimizing the immediate impact of problems introduced by the new code. In this lesson, you will learn what canary testing is and how it works. This will prepare you for the following lessons, which will show you how to implement basic canary testing with Jenkins Pipelines and Kubernetes.

Implementing a Canary Test in Kubernetes

00:10:05

Lesson Description:

In order to implement canary testing in Kubernetes, you need to have a basic idea of how to orchestrate canary pods alongside normal pods within Kubernetes itself. This video will show you how to implement this by demonstrating how to set up a canary deployment manually. This will prepare for the next lesson, which will show how this process can be automated as part of a CI/CD pipeline in Jenkins. You can find the sample source code that was used in this demo here: https://github.com/linuxacademy/cicd-pipeline-train-schedule-canary Be sure to check out the example-solution branch to find the canary deployment template in train-schedule-kube-canary.yml. Here are the commands used to deploy the stable and canary pods in the demo:

cd ~/
git clone 
cd cicd-pipeline-train-schedule-canary/
kubectl apply -f train-schedule-kube.yml
vi train-schedule-kube-canary.yml
kubectl apply -f train-schedule-kube-canary.yml

Kubernetes Canary Testing with Jenkins Pipelines

00:12:41

Lesson Description:

The orchestration functionality provided by Kubernetes is very useful in doing canary testing. Kubernetes can become even more powerful when paired with other automation tools such as Jenkins Pipelines. In this lesson, you will learn how to automate a canary deployment to a Kubernetes cluster as part of a Jenkins pipeline. Here is the sample source code used in the demo. Be sure to check out the example-solution branch for the final state of the code at the end of the demo: https://github.com/linuxacademy/cicd-pipeline-train-schedule-canary

Hands-on Labs are real live environments that put you in a real scenario to practice what you have learned without any other extra charge or account to manage.

01:00:00

Fully-Automated Deployment

Fully Automated Deployment

00:14:41

Lesson Description:

One great benefit of a robust CI/CD pipeline is that it can make fully automated deployments possible. When deployments are hands-free, it is easier to do them more frequently, and teams are more encouraged to ensure their automation is highly reliable. This lesson will demonstrate what it might look like to implement a fully automated deployment as part of Jenkins pipeline by removing human approval of deployments in favor of a simple, automated smoke test. Be sure to check out the example-solution branch of the sample code repository for the final state of the code from the demo. The repository can be found here: https://github.com/linuxacademy/cicd-pipeline-train-schedule-autodeploy

Hands-on Labs are real live environments that put you in a real scenario to practice what you have learned without any other extra charge or account to manage.

01:30:00

Next Steps

Next Steps

00:01:59

Lesson Description:

This video discusses some of the next steps you may want to take after completing this course, including other DevOps-related Linux Academy content you may be interested in.