logo资料库

The DevOps 2.4 Toolkit: Continuous Deployment To Kubernetes.pdf

第1页 / 共388页
第2页 / 共388页
第3页 / 共388页
第4页 / 共388页
第5页 / 共388页
第6页 / 共388页
第7页 / 共388页
第8页 / 共388页
资料共388页,剩余部分请下载后查看
Preface
Overview
Audience
About the Author
Dedication
Prerequisites
Rumblings Of An Old Men
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
The DevOps 2.4 Toolkit: Continuous Deployment To Kubernetes Continuously deploying applications with Jenkins to a Kubernetes cluster Viktor Farcic This book is for sale at http://leanpub.com/the-devops-2-4-toolkit This version was published on 2018-08-17 * * * * * This is a Leanpub book. Leanpub empowers authors and publishers with the Lean Publishing process. Lean Publishing is the act of publishing an in-progress ebook using lightweight tools and many iterations to get reader feedback, pivot until you have the right book and build traction once you do. * * * * * © 2018 Viktor Farcic
Table of Contents Preface Overview Audience About the Author Dedication Prerequisites Rumblings Of An Old Men 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
Preface Soon after I started working on The DevOps 2.3 Toolkit: Kubernetes, I realized that a single book could only scratch the surface. Kubernetes is vast, and no single book can envelop even all the core components. If we add community projects, the scope becomes even more extensive. Then we need to include hosting vendors and different ways to set up and manage Kubernetes. That would inevitably lead us to third-party solutions like OpenShift, Rancher, and DockerEE, to name a few. It doesn’t end there. We’d need to explore other types of community and third-party additions like those related to networking and storage. And don’t forget the processes like, for example, continuous delivery and deployment. All those things could not be explored in a single book so The DevOps 2.3 Toolkit: Kubernetes ended up being an introduction to Kubernetes. It can serve as the base for exploring everything else. The moment I published the last chapter of The DevOps 2.3 Toolkit: Kubernetes, I started working on the next material. A lot of ideas and tryouts came out of it. It took me a while until the subject and the form of the forthcoming book materialized. After a lot of consultation with the readers of the previous book, the decision was made to explore continuous delivery and deployment processes in a Kubernetes cluster. The high-level scope of the book you are reading right now was born.
Overview 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.
分享到:
收藏