DevOps with Kubernetes - Second Edition

Book Description

Leverage the power of Kubernetes to build an efficient software delivery pipeline.

Key Features

  • Learn about DevOps, containers, and Kubernetes all within one handy book
  • A practical guide to container management and orchestration
  • Learn how to monitor, log, and troubleshoot your Kubernetes applications

Book Description

Kubernetes has been widely adopted across public clouds and on-premise data centers. As we're living in an era of microservices, knowing how to use and manage Kubernetes is an essential skill for everyone in the IT industry.

This book is a guide to everything you need to know about Kubernetes - from simply deploying a container to administrating Kubernetes clusters wisely. You'll learn about DevOps fundamentals, as well as deploying a monolithic application as microservices and using Kubernetes to orchestrate them. You will then gain an insight into the Kubernetes network, extensions, authentication and authorization.

With the DevOps spirit in mind, you'll learn how to allocate resources to your application and prepare to scale them efficiently. Knowing the status and activity of the application and clusters is crucial, so we'll learn about monitoring and logging in Kubernetes. Having an improved ability to observe your services means that you will be able to build a continuous delivery pipeline with confidence. At the end of the book, you'll learn how to run managed Kubernetes services on three top cloud providers: Google Cloud Platform, Amazon Web Services, and Microsoft Azure.

What you will learn

  • Learn fundamental and advanced DevOps skills and tools
  • Get a comprehensive understanding of containers
  • Dockerize an application
  • Administrate and manage Kubernetes cluster
  • Extend the cluster functionality with custom resources
  • Understand Kubernetes network and service mesh
  • Implement Kubernetes logging and monitoring
  • Manage Kubernetes services in Amazon Web Services, Google Cloud Platform,and Microsoft Azure

Who this book is for

This book is for anyone who wants to learn containerization and clustering in a practical way using Kubernetes. No prerequisite skills are required, however, essential DevOps skill and public/private Cloud knowledge will accelerate the reading speed. If you're advanced, you can get a deeper understanding of all the tools and technique described in the book.

Publisher Resources

Download Example Code

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. DevOps with Kubernetes Second Edition
  3. About Packt
    1. Why subscribe?
    2. Packt.com
  4. Contributors
    1. About the authors
    2. About the reviewer
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  6. Introduction to DevOps
    1. Software delivery challenges
      1. Waterfall and static delivery
      2. Agile and digital delivery
      3. Software delivery on the cloud
      4. Continuous integration
      5. Continuous delivery
        1. Configuration management
        2. Infrastructure as code
        3. Orchestration
    2. The microservices trend
      1. Modular programming
      2. Package management
      3. The MVC design pattern
      4. Monolithic applications
      5. Remote procedure call
      6. RESTful design
      7. Microservices
    3. Automation and tools
      1. Continuous integration tools
      2. Configuration management tools
      3. Monitoring and logging tools
      4. Communication tools
      5. The public cloud
    4. Summary
  7. DevOps with Containers
    1. Understanding containers
      1. Resource isolation
      2. Linux containers
      3. Containerized delivery
      4. Getting started with containers
        1. Installing Docker for Ubuntu
        2. Installing Docker for CentOS
        3. Installing Docker for macOS
    2. The life cycle of a container
      1. The basics of Docker
      2. Layers, images, containers, and volumes
      3. Distributing images
      4. Connecting containers
    3. Working with a Dockerfile
      1. Writing your first Dockerfile
      2. The syntax of a Dockerfile
      3. Organizing a Dockerfile
      4. Multi-stage builds
    4. Multi-container orchestration
      1. Piling up containers
      2. An overview of Docker compose
      3. Composing containers
    5. Summary
  8. Getting Started with Kubernetes
    1. Understanding Kubernetes
      1. Kubernetes components
        1. Master components
          1. API server (kube-apiserver)
          2. Controller manager (kube-controller-manager)
          3. etcd
          4. Scheduler (kube-scheduler)
        2. Node components
          1. Kubelet
          2. Proxy (kube-proxy)
          3. Docker
        3. The interaction between the Kubernetes master and nodes
    2. Getting started with Kubernetes
      1. Preparing the environment
      2. kubectl
      3. Kubernetes resources
        1. Kubernetes objects
          1. Namespaces
          2. Name
          3. Label and selector
          4. Annotation
          5. Pods
          6. ReplicaSet
          7. Deployments
          8. Services
          9. ClusterIP
          10. NodePort
          11. LoadBalancer
          12. ExternalName (kube-dns version >= 1.7)
          13. Service without selectors
          14. Volumes
          15. Secrets
          16. Retrieving secrets via files
          17. Retrieving secrets via environment variables
          18. ConfigMap
          19. Using ConfigMap via volume
          20. Using ConfigMap via environment variables
    3. Multi-container orchestration
    4. Summary
  9. Managing Stateful Workloads
    1. Kubernetes volume management
      1. Container volume life cycle
      2. Sharing volume between containers within a pod
      3. Stateless and stateful applications
      4. Kubernetes' persistent volume and dynamic provisioning
        1. Abstracting the volume layer with a persistent volume claim
        2. Dynamic provisioning and StorageClass
      5. Problems with ephemeral and persistent volume settings
      6. Replicating pods with a persistent volume using StatefulSet
    2. Submitting Jobs to Kubernetes
      1. Submitting a single Job to Kubernetes
      2. Submitting a repeatable Job
      3. Submitting a parallel Job
      4. Scheduling running a Job using CronJob
    3. Summary
  10. Cluster Administration and Extension
    1. Kubernetes namespaces
      1. Context
        1. Creating a context
        2. Switching the current context
    2. Kubeconfig
    3. Service account
    4. Authentication and authorization
      1. Authentication
        1. Service account token authentication
        2. User account authentication
      2. Authorization
      3. Role-based access control (RBAC)
        1. Roles and ClusterRoles
        2. RoleBinding and ClusterRoleBinding
    5. Admission control
      1. NamespaceLifecycle
      2. LimitRanger
      3. ServiceAccount
      4. PersistentVolumeLabel
      5. DefaultStorageClass
      6. ResourceQuota
      7. DefaultTolerationSeconds
      8. PodNodeSelector
      9. AlwaysPullImages
      10. DenyEscalatingExec
      11. Other admission controller plugins
      12. Dynamic admission control
        1. Admission webhook
    6. Custom resources
      1. Custom resources definition
    7. Summary
  11. Kubernetes Network
    1. Kubernetes networking
      1. Docker networking
      2. Container-to-container communications
      3. Pod-to-pod communications
        1. Pod communication within the same node
        2. Pod communication across nodes
      4. Pod-to-service communications
      5. External-to-service communications
    2. Ingress
    3. Network policy
    4. Service mesh
    5. Summary
  12. Monitoring and Logging
    1. Inspecting a container
      1. The Kubernetes dashboard
    2. Monitoring in Kubernetes
      1. Monitoring applications
      2. Monitoring infrastructure
      3. Monitoring external dependencies
      4. Monitoring containers
      5. Monitoring Kubernetes
      6. Getting monitoring essentials for Kubernetes
    3. Hands-on monitoring
      1. Getting to know Prometheus
      2. Deploying Prometheus
      3. Working with PromQL
      4. Discovering targets in Kubernetes
      5. Gathering data from Kubernetes
      6. Visualizing metrics with Grafana
    4. Logging events
      1. Patterns of aggregating logs
        1. Collecting logs with a logging agent per node
        2. Running a sidecar container to forward written logs
      2. Ingesting Kubernetes state events
      3. Logging with Fluent Bit and Elasticsearch
      4. Extracting metrics from logs
    5. Incorporating data from Istio
      1. The Istio adapter model
      2. Configuring Istio for existing infrastructure
        1. Mixer templates
        2. Handler adapters
        3. Rules
    6. Summary
  13. Resource Management and Scaling
    1. Scheduling workloads
      1. Optimizing resource utilization
        1. Resource types and allocations
        2. Quality of Service (QoS) classes
      2. Placing pods with constraints
        1. Node selector
        2. Affinity and anti-affinity
          1. Node affinity
          2. Inter-pod affinity
      3. Prioritizing pods in scheduling
    2. Elastically scaling
      1. Horizontal pod autoscaler
      2. Incorporating custom metrics
    3. Managing cluster resources
      1. Resource quotas of namespaces
        1. Creating a ResourceQuota
        2. Request pods with default compute resource limits
      2. Node administration
        1. Pod eviction
        2. Taints and tolerations
    4. Summary
  14. Continuous Delivery
    1. Updating resources
      1. Triggering updates
      2. Managing rollouts
      3. Updating DaemonSet and StatefulSet
        1. DaemonSet
        2. StatefulSet
    2. Building a delivery pipeline
      1. Choosing tools
      2. End-to-end walk-through of the delivery pipeline 
        1. The steps explained
          1. env
          2. script
          3. after_success
          4. deploy
    3. Gaining a deeper understanding of pods
      1. Starting a pod
        1. Liveness and readiness probes
        2. Custom readiness gate
        3. init containers
      2. Terminating a pod
        1. Handling SIGTERM
          1. SIGTERM isn't sent to the application process
          2. SIGTERM doesn't invoke the termination handler
      3. Container life cycle hooks
      4. Tackling pod disruptions
    4. Summary
  15. Kubernetes on AWS
    1. Introduction to AWS
      1. Public cloud
      2. API and infrastructure as code
      3. AWS components
        1. VPC and subnet
        2. Internet gateways and NAT-GW
        3. Security group
        4. EC2 and EBS
        5. ELB
    2. Amazon EKS
      1. Deep dive into AWS EKS
      2. Launching the EKS control plane
      3. Adding worker nodes
      4. Cloud provider on EKS
        1. Storage class
        2. Load balancer
          1. Internal load balancer
          2. Internet-facing load balancer
      5. Updating the Kubernetes version on EKS
        1. Upgrading the Kubernetes master
        2. Upgrading worker nodes
    3. Summary
  16. Kubernetes on GCP
    1. Introduction to GCP
      1. GCP components
        1. VPC
        2. Subnets
        3. Firewall rules
        4. VM instances
        5. Load balancing
          1. Health check
          2. Backend service
          3. Creating a LoadBalancer
        6. Persistent Disk
    2. Google Kubernetes Engine (GKE)
      1. Setting up your first Kubernetes cluster on GKE
      2. Node pool
      3. Multi-zone clusters
      4. Cluster upgrade
      5. Kubernetes cloud provider
        1. StorageClass
        2. L4 LoadBalancer
        3. L7 LoadBalancer (ingress)
    3. Summary
  17. Kubernetes on Azure
    1. Introduction to Azure
      1. Resource groups
      2. Azure virtual network
        1. Network security groups
        2. Application security groups
        3. Subnets
      3. Azure virtual machines
      4. Storage account
      5. Load balancers
      6. Azure disks
    2. Azure Kubernetes service
      1. Setting up your first Kubernetes cluster on AKS
      2. Node pools
      3. Cluster upgrade
      4. Monitoring and logging
      5. Kubernetes cloud provider
        1. Role-based access control
        2. StorageClass
        3. L4 LoadBalancer
        4. Ingress controller
    3. Summary
  18. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product Information

  • Title: DevOps with Kubernetes - Second Edition
  • Author(s): Hideto Saito, Hui-Chuan Chloe Lee, Cheng-Yang Wu
  • Release date: January 2019
  • Publisher(s): Packt Publishing
  • ISBN: 9781789533996