The DevOps 2.4 Toolkit: Continuous Deployment to Kubernetes

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Just like other books I wrote, this one did not have a fixed scope. I did not start with an index. I didn't write a summary of each chapter in an attempt to define the scope. I do not do such things. There was only a high-level goal to explore continuous delivery and deployment inside Kubernetes clusters. What I did do, though, was to set a few guidelines.The first guideline is that "all the examples will be tested on all major Kubernetes platforms." Well, that might be a bit far-fetched. I'm aware that any sentence that mentions "all" together with "Kubernetes" is bound to be incorrect. New platforms are popping out like mushrooms after rain. Still, what I can certainly do is to choose a few of the most commonly used ones.Minikube and Docker for Mac or Windows should undoubtedly be there for those who prefer to "play" with Docker locally.AWS is the biggest hosting provider so Kubernetes Operations (kops) must be included as well.Since it would be silly to cover only un-managed cloud, I had to include managed Kubernetes clusters as well. Google Kubernetes Engine (GKE) is the obvious choice. It is the most stable and features rich managed Kubernetes solution. Adding GKE to the mix means that Azure Container Service (AKS) and Amazon's Elastic Container Service (EKS) should be included as well so that we can have the "big trio" of the hosting vendors that offer managed Kubernetes. Unfortunately, at the time of this writing (May 2018), Elastic Container Service (EKS) is in the preview stage and Amazon is providing access only to a relatively small number of people. AKS, on the other hand, is available but, at this moment, it is too unstable. So, I'm forced to scale down from the trio to GKE as the only managed Kubernetes we'll explore.Finally, a possible on-prem solution should be included as well. Since OpenShift shines in that area, the choice was relatively easy.All in all, I decided to test everything in minikube and Docker for Mac locally, AWS with kops as the representative of a cluster in the cloud, GKE for managed Kubernetes clusters, and OpenShift (with minishift) as a potential on-prem solution. That, in itself, already constitutes a real challenge that might prove to be more than I can chew. Still, making sure that all the examples work with all those platforms and solutions should provide some useful insights.Some of you already chose the Kubernetes flavor you'll use. Others might still wonder whether to adopt one or the other. Even though the comparison of different Kubernetes platforms is not the primary scope of the book, I'll do my best to explain the differences as they come.To summarize the guidelines, the book has to explore continuous delivery and deployment in Kubernetes using Jenkins. All the examples have to be tested in minikube, Docker for Mac (or Windows), AWS with kops, GKE, and OpenShift with minishift, and EKS.

Author(s): Viktor Farcic
Publisher: Packt Publishing
Year: 2019

Language: English
Pages: 398
City: Birmingham, UK

Cover
Title Page
Copyright and Credits
About Packt
Dedication
Contributor
Table of Contents
Preface
Chapter 1: Deploying Stateful Applications at Scale
Creating a cluster
Using StatefulSets to run Stateful applications
Using Deployments to run Stateful applications at scale
Using StatefulSets to run Stateful applications at scale
Using sidecar containers to initialize applications
To StatefulSet or not to StatefulSet
What now?
Chapter 2: Enabling Process Communication with Kube API Through Service Accounts
Creating a cluster
Configuring Jenkins Kubernetes plugin
Exploring the default ServiceAccount
Creating ServiceAccounts
Configuring Jenkins Kubernetes plugin with ServiceAccounts
Using ServiceAccounts from side-car containers
What now?
Chapter 3: Defining Continuous Deployment
To continuously deliver or to continuously deploy?
Defining continuous deployment goals
Defining continuous deployment steps
Creating a cluster
Creating Namespaces dedicated to continuous deployment processes
Defining a Pod with the tools
Executing continuous integration inside containers
Running functional tests
Creating production releases
Deploying to production
Running production tests
Cleaning up pipeline leftovers
Did we do it?
What now?
Chapter 4: Packaging Kubernetes Applications
Creating a cluster
What Is Helm?
Installing Helm
Installing Helm Charts
Customizing Helm installations
Rolling back Helm revisions
Using YAML values to customize Helm installations
Creating Helm Charts
Exploring files that constitute a Chart
Upgrading Charts
Helm vs. OpenShift templates
What now?
Chapter 5: Distributing Kubernetes Applications
Creating a cluster and retrieving its IP
Using ChartMuseum
Using Monocular
What now?
Chapter 6: Installing and Setting Up Jenkins
Creating a Cluster and retrieving its IP
Running Jenkins
Using Pods to run tools
Running builds in different Namespaces
Creating nodes for building container images
Creating a VM with Vagrant and VirtualBox
Creating Amazon Machine Images (AMIs)
Creating Google Cloud Engine (GCE) images
Testing Docker builds outside the cluster
Automating Jenkins installation and setup
What now?
Chapter 7: Creating a Continuous Deployment Pipeline with Jenkins
Exploring the continuous deployment process
Creating a cluster
Installing Jenkins
Defining the build stage
Defining the functional testing stage
Defining the release stage
Defining the deploy stage
What are we missing in our pipeline?
Reusing pipeline snippets through global pipeline libraries
Consulting global pipeline libraries documentation
Using Jenkins file and Multistage builds
What now?
Chapter 8: Continuous Delivery with Jenkins and GitOps
Creating a cluster
Defining the whole production environment
What is the continuous delivery pipeline?
Exploring application's repository and preparing the environment
Switching from Scripted to Declarative Pipeline
Demystifying Declarative Pipeline through a practical example
Creating and running a continuous delivery job
What is GitOps and do we want it?
Upgrading the production environment using GitOps practices
Creating a Jenkins job that upgrades the whole production environment
Automating upgrade of the production environment
High-level overview of the continuous delivery pipeline
To continuously deploy or to continuously deliver?
What now?
Appendix A: Installing kubectl and Creating a Cluster with minikube
Running Kubernetes Cluster Locally
Installing kubectl
Installing Minikube
Creating a local Kubernetes cluster with Minikube
What Now?
Appendix B: Using Kubernetes Operations (kops)
Preparing for the cluster setup
Creating a Kubernetes cluster in AWS
Installing Ingress and Tiller (server side Helm)
Destroying the cluster
Now It Is Your Turn
Other Books You May Enjoy
Index