Kubernetes - A Complete DevOps Cookbook
eBook - ePub

Kubernetes - A Complete DevOps Cookbook

Build and manage your applications, orchestrate containers, and deploy cloud-native services

  1. 584 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Kubernetes - A Complete DevOps Cookbook

Build and manage your applications, orchestrate containers, and deploy cloud-native services

About this book

Leverage Kubernetes and container architecture to successfully run production-ready workloads

Key Features

  • Implement Kubernetes to orchestrate and scale applications proficiently
  • Leverage the latest features of Kubernetes to resolve common as well as complex problems in a cloud-native environment
  • Gain hands-on experience in securing, monitoring, and troubleshooting your application

Book Description

Kubernetes is a popular open source orchestration platform for managing containers in a cluster environment. With this Kubernetes cookbook, you'll learn how to implement Kubernetes using a recipe-based approach. The book will prepare you to create highly available Kubernetes clusters on multiple clouds such as Amazon Web Services (AWS), Google Cloud Platform (GCP), Azure, Alibaba, and on-premises data centers.

Starting with recipes for installing and configuring Kubernetes instances, you'll discover how to work with Kubernetes clients, services, and key metadata. You'll then learn how to build continuous integration/continuous delivery (CI/CD) pipelines for your applications, and understand various methods to manage containers. As you advance, you'll delve into Kubernetes' integration with Docker and Jenkins, and even perform a batch process and configure data volumes. You'll get to grips with methods for scaling, security, monitoring, logging, and troubleshooting. Additionally, this book will take you through the latest updates in Kubernetes, including volume snapshots, creating high availability clusters with kops, running workload operators, new inclusions around kubectl and more.

By the end of this book, you'll have developed the skills required to implement Kubernetes in production and manage containers proficiently.

What you will learn

  • Deploy cloud-native applications on Kubernetes
  • Automate testing in the DevOps workflow
  • Discover and troubleshoot common storage issues
  • Dynamically scale containerized services to manage fluctuating traffic needs
  • Understand how to monitor your containerized DevOps environment
  • Build DevSecOps into CI/CD pipelines

Who this book is for

This Kubernetes book is for developers, IT professionals, and DevOps engineers and teams who want to use Kubernetes to manage, scale, and orchestrate applications in their organization. Basic understanding of Kubernetes and containerization is necessary.

Trusted by 375,005 students

Access to over 1 million titles for a fair monthly price.

Study more efficiently using our study tools.

Information

Year
2020
Print ISBN
9781838828042
Edition
1
eBook ISBN
9781838820336
Building CI/CD Pipelines
In this chapter, we will discuss the configuration of end-to-end Continuous Integration/Continuous Delivery (CI/CD) pipelines using the most popular CI/CD tools on both self-managed public clouds and SaaS solutions using Kubernetes. After following the recipes in this chapter, you will have gained the skills needed to build, deploy, and promote applications from development to a production environment. You will be able to use the tools that we will implement in these recipes to detect bugs, anti-patterns, and license concerns during the continuous integration process.
In this chapter, we will cover the following recipes:
  • Creating a CI/CD pipeline in Jenkins X
  • Creating a CI/CD pipeline in GitLab
  • Creating a CI/CD pipeline using CircleCI
  • Setting up a CI/CD pipeline using GitHub Actions
  • Setting up a CI/CD pipeline on Amazon Web Services
  • Setting up a CI/CD pipeline with Spinnaker on Google Cloud Build
  • Setting up a CI/CD pipeline on Azure DevOps

Technical requirements

The recipes in this section assume that you have a functional Kubernetes cluster deployed after following one of the recommended methods described in Chapter 1, Building Production-Ready Kubernetes Clusters.
Kubernetes' command-line interface, kubectl, will be used for the rest of the recipes in this section since it's the main command-line interface for running commands against Kubernetes clusters. If you are using a Red Hat OpenShift cluster, you can replace kubectl with oc. All the commands are expected to function similarly.
The recipes in this section require a Git repository with a containerized project.

Creating a CI/CD pipeline in Jenkins X

Jenkins X is a fairly new open source solution that extends the Jenkins ecosystem and solves the problem of automating CI/CD in the cloud using Kubernetes.
In this section, we will learn how to get your application as a pipeline into Jenkins X, which you will have deployed by following the Deploying and managing the life cycle of Jenkins X recipe instructions in Chapter 2, Operating Applications on Kubernetes. With that, you will learn how to create a CI/CD pipeline with automated GitOps and promote an application from staging to production, all by using simple commands.

Getting ready

Make sure you have followed the instructions in Chapter 2, Operating Applications on Kubernetes, in the Deploying and managing the life cycle of Jenkins X recipe and have a functional Kubernetes cluster with a Jenkins X deployment ready. You can find the instructions to install helm in that chapter as well.
In the following recipe, you will learn how to create a pipeline with GitOps promotion.
This recipe requires kubectl, helm, the Jenkins X CLI, jx, and your preferred cloud provider CLI where you installed your Kubernetes cluster using Jenkins X.
Jenkins X supports Azure, AWS, GCP, IBM Cloud, Oracle Cloud, minikube, minishift, and OpenShift as providers for the deployment process. You also need to have a GitHub organization and GitHub account.

How to do it…

This section is further divided into the following subsections to make this process easier:
  • Connecting to the Jenkins pipeline console
  • Importing an application as a pipeline
  • Checking application status
  • Promoting an application to production
  • Creating a pipeline using a quick-start application

Connecting to Jenkins Pipeline Console

Let's perform the following steps to access the Jenkins Pipeline Console web interface:
  1. Switch to the jx namespace where Jenkins X is deployed:
$ jx ns
? Change namespace: [Use arrows to move, space to select, type to filter]
default
> jx
jx-production
jx-staging
kube-public
kube-system
  1. Using the following command to get the Jenkins (Blue Ocean) console address and open the link in your browser. In this recipe, the console address is the output to the following jx console command, that is, http://jenkins.jx.your_ip.nip.io/blue:
$ jx console
Jenkins Console: http://jenkins.jx.your_ip.nip.io/blue
  1. After you've opened the Jenkins Console link from the output of step 2, click on one of the pipelines from the list. As an example, you can see two pipelines in our following demo environment:
  1. Select the last run and make sure both pipelines are healthy, meaning that your environment works. Similar to the following screenshot, you should see green check marks at the Validate Environment and Update Environment stages:
...

Table of contents

  1. Title Page
  2. Copyright and Credits
  3. Dedication
  4. About Packt
  5. Contributors
  6. Preface
  7. Building Production-Ready Kubernetes Clusters
  8. Operating Applications on Kubernetes
  9. Building CI/CD Pipelines
  10. Automating Tests in DevOps
  11. Preparing for Stateful Workloads
  12. Disaster Recovery and Backup
  13. Scaling and Upgrading Applications
  14. Observability and Monitoring on Kubernetes
  15. Securing Applications and Clusters
  16. Logging with Kubernetes
  17. Other Books You May Enjoy

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access Kubernetes - A Complete DevOps Cookbook by Murat Karslioglu in PDF and/or ePUB format, as well as other popular books in Computer Science & Software Development. We have over one million books available in our catalogue for you to explore.