The DevOps 2.4 Toolkit: Continuous Deployment To Kubernetes

Retired

This book is no longer available for sale.

The DevOps 2.4 Toolkit: Continuous Deployment To Kubernetes

Continuously deploying applications with Jenkins to a Kubernetes cluster

About the Book

Just like the other books I wrote, this one does 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 is 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, even though AKS is available, it is, at this moment (June 2018), still too unstable and it's missing a lot of features. So, I'm forced to scale down from the trio to the GKE and EKS duo as representatives of 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, it explores continuous delivery and deployment in Kubernetes using Jenkins. All the examples are tested in minikube, Docker for Mac (or Windows), AWS with kops, GKE, OpenShift with minishift, and EKS.

About the Author

Viktor Farcic
Viktor Farcic

Viktor Farcic is a lead rapscallion at Upbound, a member of the CNCF AmbassadorsGoogle Developer Experts, CDF Ambassadors, and GitHub Stars groups, and a published author.

He is a host of the YouTube channel DevOps Toolkit and a co-host of DevOps Paradox.

Table of Contents

  • Preface
  • Overview
  • Audience
  • About the Author
  • Dedication
  • Prerequisites
  • Rumblings Of An Old Man
    • What Is Continuous Deployment?
  • 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?
  • 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?
  • 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?
  • 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?
  • Distributing Kubernetes Applications
    • Creating A Cluster And Retrieving Its IP
    • Using ChartMuseum
    • Using Monocular
    • What Now?
  • 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
    • Testing Docker Builds Outside The Cluster
    • Automating Jenkins Installation And Setup
    • What Now?
  • 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 Jenkinsfile & Multistage Builds
    • What Now?
  • 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’s Your Turn
  • Contributions

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub