Introduction to DevOps with Kubernetes

Book description

Become familiar with Kubernetes and explore techniques to manage your containerized workloads and services

Key Features

  • Learn everything from creating a cluster to monitoring applications in Kubernetes
  • Understand and develop DevOps primitives using Kubernetes
  • Use Kubernetes to solve challenging real-life DevOps problems

Book Description

Kubernetes and DevOps are the two pillars that can keep your business at the top by ensuring high performance of your IT infrastructure.

Introduction to DevOps with Kubernetes will help you develop the skills you need to improve your DevOps with the power of Kubernetes. The book begins with an overview of Kubernetes primitives and DevOps concepts. You'll understand how Kubernetes can assist you with overcoming a wide range of real-world operation challenges. You will get to grips with creating and upgrading a cluster, and then learn how to deploy, update, and scale an application on Kubernetes. As you advance through the chapters, you'll be able to monitor an application by setting up a pod failure alert on Prometheus. The book will also guide you in configuring Alertmanager to send alerts to the Slack channel and trace down a problem on the application using kubectl commands.

By the end of this book, you'll be able to manage the lifecycle of simple to complex applications on Kubernetes with confidence.

What you will learn

  • Create and manage Kubernetes clusters in on-premise systems and cloud
  • Exercise various DevOps practices using Kubernetes
  • Explore configuration, secret, and storage management, and exercise these on Kubernetes
  • Perform different update techniques and apply them on Kubernetes
  • Use the built-in scaling feature in Kubernetes to scale your applications up and down
  • Use various troubleshooting techniques and have a monitoring system installed on Kubernetes

Who this book is for

If you are a developer who wants to learn how to apply DevOps patterns using Kubernetes, then this book is for you. Familiarity with Kubernetes will be useful, but not essential.

Publisher resources

Download Example Code

Table of contents

  1. Preface
    1. About the Book
      1. About the Authors
      2. Objectives
      3. Audience
      4. Approach
      5. Hardware Requirements
      6. Software Requirements
      7. Conventions
      8. Installation and Setup
      9. Additional Resources
  2. Chapter 1
  3. Introduction to DevOps
    1. Introduction
      1. DevOps' Effect on Industry
      2. DevOps Culture and its Benefits
    2. The DevOps Toolchain
      1. Plan
      2. Exercise 1: Creating a Repository and Project Board on GitHub
      3. Create
      4. Exercise 2: Creating a DevOps Blog
      5. Verify
      6. Exercise 3: Connecting the DevOps Blog to a CI/CD System
      7. Package
      8. Release
      9. Exercise 4: Releasing the DevOps Blog
      10. Configure
      11. Monitor
      12. Activity 1: CI/CD Pipeline for the DevOps Blog
    3. Summary
  4. Chapter 2
  5. Introduction to Microservices and Containers
    1. Introduction
    2. Introduction to Docker
      1. The Fundamental Concepts of Docker
      2. Exercise 5: Creating a "Hello World" Container in Docker
    3. Building Docker Images
      1. Dockerfiles
      2. The Docker Registry
      3. Exercise 6: Building a Docker Image and Pushing it to Docker Hub
    4. Running Docker Containers
      1. Exercise 7: Running Docker Containers, Volume Mapping, and Port Sharing
      2. Activity 2: Installing a WordPress Blog and Database Using Docker
    5. Summary
  6. Chapter 3
  7. Introduction to Kubernetes
    1. Introduction
      1. What is Kubernetes?
    2. Kubernetes Architecture
      1. Master Components
      2. Node Components
      3. Exercise 8: Installing and Starting a Local Kubernetes Cluster
    3. Accessing Kubernetes Clusters
      1. Exercise 9: Checking Application Status in Kubernetes Dashboard
      2. Exercise 10: Carrying Out Cluster Management Using kubectl
    4. Fundamental Kubernetes Resources
      1. The Pod
      2. Replication Sets
      3. Deployment
      4. Stateful Sets
      5. Activity 3: Installing a WordPress Blog and Database on Kubernetes
    5. Summary
  8. Chapter 4
  9. Creating a Kubernetes Cluster
    1. Introduction
    2. Manual Kubernetes Cluster Setup
      1. Exercise 11: Creating a Kubernetes Cluster Using kubeadm
    3. Kubernetes Cluster Considerations
      1. Development or Production-Ready Setup
      2. In-House or Managed Services
      3. On-Premises or Cloud Infrastructure
      4. Vanilla Kubernetes or Custom Solutions
    4. Kubernetes Platform Options
      1. Local Machine Solutions
      2. Hosted Solutions
      3. Turnkey Solutions
      4. Heptio
      5. CoreOS Tectonic
      6. Red Hat OpenShift
      7. Exercise 12 – Creating Managed Kubernetes Clusters on GCP
      8. Activity 4: Migrating a Running Application in Kubernetes Cluster
    5. Summary
  10. Chapter 5
  11. Deploy an Application to Kubernetes
    1. Introduction
    2. Object Management in Kubernetes
      1. Imperative Commands
      2. Imperative Configuration
      3. Declarative Configuration
      4. Exercise 13: Deploying Applications Using kubectl
    3. Service Discovery in Kubernetes
      1. Exercise 14: Access Applications Using Services
    4. Kubernetes Package Manager: Helm
      1. Exercise 15: Installing Helm in the Kubernetes Cluster
      2. Activity 5: Installing and Scaling a WordPress Blog in Kubernetes Using Helm
    5. Summary
  12. Chapter 6
  13. Configuration and Storage Management in Kubernetes
    1. Configuration Management
      1. Infrastructure Configurations
      2. Runtime Configurations
    2. Configuration Management in Kubernetes
      1. Creating a ConfigMap
      2. Updating a ConfigMap
      3. Consuming ConfigMaps from a Pod
      4. Exercise 16: Create ConfigMaps from a Literal and a File
    3. Secret Management
    4. Secret Management Best Practices
      1. Identifying Secrets
      2. Decoupling Secrets from the Source Code
      3. Rotating Secrets
      4. Principle of Least Privilege
      5. Preventing Printing Out Secrets on Application Logs
      6. Encryption at Rest
      7. Secret Management in Kubernetes
      8. Creating a Secret
      9. Updating a Secret
      10. Consuming Secrets from a Pod
      11. Exercise 17: Create and Update a Secret
      12. Activity 6: Updating Configurations on the Fly
    5. Storage Management
    6. Storage Management in Kubernetes
      1. Volume
      2. emptyDir
      3. gcePersistentDisk
      4. glusterfs
      5. Exercise 18: Use emptyDir Volume to Share Content Between Containers
      6. Persistent Volume (PV)
      7. Persistent Volume Claim (PVC)
      8. Access Modes
      9. Storage Class
    7. Activity 7: Running a Persistent Database on Kubernetes
    8. Summary
  14. Chapter 7
  15. Updating and Scaling an Application in Kubernetes
    1. Updating an Application
      1. Blue-Green Deployments
      2. Rolling Updates
      3. Canary Releases
      4. Dark Launches and Feature Toggles
      5. Software Update versus Software Upgrade
    2. Updating an Application in Kubernetes
      1. StatefulSet Update Strategies
      2. OnDelete
      3. RollingUpdate
      4. Deployment Update Strategies
      5. Recreate
      6. RollingUpdate
      7. Performing Blue-Green Deployment in Kubernetes
      8. Performing Rolling Updates in Kubernetes
      9. maxSurge
      10. maxUnavailable
      11. Updating a Deployment Using a Rolling Update
      12. Updating an Application using Helm
      13. Exercise 19: Updating a Deployment in Kubernetes Using a Rolling Update
      14. Scaling an Application
      15. Horizontal versus Vertical Scaling
      16. Autoscaling
      17. Strong versus Eventual Consistency
    3. Scaling an Application in Kubernetes
      1. Exercise 20: Scaling a Deployment Up and Down in Kubernetes
      2. Horizontal Pod Auto-Scaler (HPA)
      3. Activity 8: Enabling Autoscaling and Performing a Rolling Update
    4. Summary
  16. Chapter 8
  17. Troubleshooting Applications in Kubernetes
    1. Introduction
    2. Troubleshooting
      1. Identifying the Problem
      2. Improving Tests
      3. Documentation
      4. Tools
      5. Logging
      6. Logging levels
    3. Troubleshooting Applications in Kubernetes
      1. Pod Life Cycle
      2. Pod Status
      3. Pod Conditions
      4. Condition Types
      5. Pod Phase
      6. Restart Policy
      7. Container States
      8. Auto Recovery
      9. Health checks
      10. Liveness Probe
      11. Readiness Probe
      12. Exercise 21: Using Liveness and Readiness Probes in Kubernetes
      13. Creating a Termination Log
      14. Handy Commands for Troubleshooting
      15. Other Handy Commands
      16. Action Commands
      17. Suggestions for Some Common Problems
      18. Lack of Resources
      19. Image Pull Failure
      20. Exercise 22: Fixing a Pod Failure in Kubernetes
      21. Ask the Community
      22. Activity 9: Troubleshooting an Application in Kubernetes
    4. Summary
  18. Chapter 9
  19. Monitoring Applications in Kubernetes
    1. Monitoring
      1. Infrastructure Monitoring
      2. Application Performance Monitoring (APM)
      3. Alerting
      4. Tools
    2. Monitoring Applications in Kubernetes
      1. Prometheus
      2. Alertmanager
      3. Grafana
      4. Creating a Dashboard in Grafana
      5. Exercise 23: Installing Prometheus and Grafana
    3. Custom Metrics
      1. Exercise 24: Exposing a Custom Metric in Prometheus
    4. Exposed Metrics in Kubernetes
      1. Slack
      2. Incoming Webhooks
      3. Exercise 25: Signing Up for Slack and Creating a Workspace
      4. Activity 10: Setting Up Alert Notifications in Kubernetes
    5. Summary
  20. Appendix
    1. Chapter 1: Introduction to DevOps
      1. Activity 1: CI/CD Pipeline for the DevOps Blog
      2. Solution:
    2. Chapter 2: Introduction to Microservices and Containers
      1. Activity 2: Installing a WordPress Blog and Database Using Docker
    3. Chapter 3: Introduction to Kubernetes
      1. Activity 3: Installing a WordPress Blog and Database on Kubernetes
    4. Chapter 4: Creating a Kubernetes Cluster
      1. Activity 4: Migrating a Running Application in Kubernetes Cluster
    5. Chapter 5: Deploy an Application to Kubernetes
      1. Activity 5: Installing and Scaling a WordPress Blog in Kubernetes Using Helm
    6. Chapter 6: Configuration and Storage Management in Kubernetes
      1. Activity 6: Updating Configurations on the Fly
      2. Activity 7: Running a Persistent Database on Kubernetes
      3. Solution:
    7. Chapter 7: Updating and Scaling an Application in Kubernetes
      1. Activity 8: Enabling Autoscaling and Performing a Rolling Update
      2. Solution:
    8. Chapter 8: Troubleshooting Applications in Kubernetes
      1. Activity 9: Troubleshooting an Application in Kubernetes
    9. Chapter 9: Monitoring Applications in Kubernetes
      1. Activity 10: Setting Up Alert Notifications in Kubernetes

Product information

  • Title: Introduction to DevOps with Kubernetes
  • Author(s): Onur Yilmaz, Suleyman Akbas
  • Release date: May 2019
  • Publisher(s): Packt Publishing
  • ISBN: 9781789808285