The DevOps 2.4 Toolkit: Continuous Deployment To Kubernetes
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.
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
Authors have earned$9,913,563writing, publishing and selling on Leanpub, earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.
Learn more about writing on Leanpub
The Leanpub 45-day 100% Happiness Guarantee
Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
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), EPUB (for phones and tablets) and MOBI (for 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
Top Books
C++ Best Practices
Jason TurnerLevel up your C++, get the tools working for you, eliminate common problems, and move on to more exciting things!
Continuous Delivery Pipelines
Dave FarleyThis practical handbook provides a step-by-step guide for you to get the best continuous delivery pipeline for your software.
OpenIntro Statistics
David Diez, Christopher Barr, Mine Cetinkaya-Rundel, and OpenIntroA complete foundation for Statistics, also serving as a foundation for Data Science.
Leanpub revenue supports OpenIntro (US-based nonprofit) so we can provide free desk copies to teachers interested in using OpenIntro Statistics in the classroom and expand the project to support free textbooks in other subjects.
More resources: openintro.org.
C++20
Rainer GrimmC++20 is the next big C++ standard after C++11. As C++11 did it, C++20 changes the way we program modern C++. This change is, in particular, due to the big four of C++20: ranges, coroutines, concepts, and modules.
The book is almost daily updated. These incremental updates ease my interaction with the proofreaders.
Atomic Kotlin
Bruce Eckel and Svetlana IsakovaFor both beginning and experienced programmers! From the author of the multi-award-winning Thinking in C++ and Thinking in Java together with a member of the Kotlin language team comes a book that breaks the concepts into small, easy-to-digest "atoms," along with exercises supported by hints and solutions directly inside IntelliJ IDEA!
Introductory Statistics with Randomization and Simulation
Mine Cetinkaya-Rundel, Christopher Barr, OpenIntro, and David DiezA complete foundation for Statistics, also serving as a foundation for Data Science, that introduces inference using randomization and simulation while covering traditional methods.
Leanpub revenue supports OpenIntro, so we can provide free desk copies to teachers interested in using our books in the classroom.
More resources: openintro.org.
Ansible for DevOps
Jeff GeerlingAnsible is a simple, but powerful, server and configuration management tool. Learn to use Ansible effectively, whether you manage one server—or thousands.
Java OOP Done Right
Alan MellorObject Oriented Programming is still a great way to create clean, maintainable code. But only if you use it right.
This book gives you 25 years of OO best practice, ready to use.
You'll learn to design objects behaviour-first, use TDD to help, then confidently apply Design Patterns, SOLID principles and Refactoring to make clean, crafted code.
Introducing EventStorming
Alberto BrandoliniThe deepest tutorial and explanation about EventStorming, straight from the inventor.
Discrete Mathematics for Computer Science
Alexander Shen, Alexander S. Kulikov, Vladimir Podolskii, and Aleksandr GolovnevThis book supplements the DM for CS Specialization at Coursera and contains many interactive puzzles, autograded quizzes, and code snippets. They are intended to help you to discover important ideas in discrete mathematics on your own. By purchasing the book, you will get all updates of the book free of charge when they are released.
Top Bundles
- #1
Software Architecture for Developers: Volumes 1 & 2 - Technical leadership and communication
2 Books
"Software Architecture for Developers" is a practical and pragmatic guide to modern, lightweight software architecture, specifically aimed at developers. You'll learn:The essence of software architecture.Why the software architecture role should include coding, coaching and collaboration.The things that you really need to think about before... - #2
CCIE Service Provider Ultimate Study Bundle
2 Books
Piotr Jablonski, Lukasz Bromirski, and Nick Russo have joined forces to deliver the only CCIE Service Provider training resource you'll ever need. This bundle contains a detailed and challenging collection of workbook labs, plus an extensively detailed technical reference guide. All of us have earned the CCIE Service Provider certification... - #3
Cisco CCNA 200-301 Complet
4 Books
Ce lot comprend les quatre volumes du guide préparation à l'examen de certification Cisco CCNA 200-301. - #4
Modern C++ by Nicolai Josuttis
2 Books
- #5
CCDE Practical Studies (All labs)
3 Books
CCDE lab - #6
"The C++ Standard Library" and "Concurrency with Modern C++"
2 Books
Get my books "The C++ Standard Library" and "Concurrency with Modern C++" in a bundle. The first book gives you the details you should know about the C++ standard library; the second one dives deeper into concurrency with modern C++. In sum, you get more than 600 pages full of modern C++ and about 250 source files presenting the standard library... - #7
Mastering Containers
2 Books
Docker and Kubernetes are taking the world by storm! These books will get you up-to-speed fast! Docker Deep Dive is over 400 pages long, and covers all objectives on the Docker Certified Associate exam.The Kubernetes Book includes everything you need to get up and running with Kubernetes! - #8
The Future of Digital Health
6 Books
We put together the most popular books from The Medical Futurist to provide a clear picture about the major trends shaping the future of medicine and healthcare. Digital health technologies, artificial intelligence, the future of 20 medical specialties, big pharma, data privacy and how technology giants such as Amazon or Google want to conquer... - #9
Django for Beginners/APIs/Professionals
3 Books
- #10
Linux Administration Complet
4 Books
Ce lot comprend les quatre volumes du Guide Linux Administration :Linux Administration, Volume 1, Administration fondamentale : Guide pratique de préparation aux examens de certification LPIC 1, Linux Essentials, RHCSA et LFCS. Administration fondamentale. Introduction à Linux. Le Shell. Traitement du texte. Arborescence de fichiers. Sécurité...