DevOps with Kubernetes

Book description

Learn to implement DevOps using Docker & Kubernetes.

About This Book

  • Learning DevOps, container, and Kubernetes within one book.
  • Leverage Kubernetes as a platform to deploy, scale, and run containers efficiently.
  • A practical guide towards container management and orchestration

Who This Book Is For

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

What You Will Learn

  • Learn fundamental and advanced DevOps skills and tools
  • Get a comprehensive understanding for container
  • Learn how to move your application to container world
  • Learn how to manipulate your application by Kubernetes
  • Learn how to work with Kubernetes in popular public cloud
  • Improve time to market with Kubernetes and Continuous Delivery
  • Learn how to monitor, log, and troubleshoot your application with Kubernetes

In Detail

Containerization is said to be the best way to implement DevOps. Google developed Kubernetes, which orchestrates containers efficiently and is considered the frontrunner in container orchestration. Kubernetes is an orchestrator that creates and manages your containers on clusters of servers. This book will guide you from simply deploying a container to administrate a Kubernetes cluster, and then you will learn how to do monitoring, logging, and continuous deployment in DevOps. The initial stages of the book will introduce the fundamental DevOps and the concept of containers. It will move on to how to containerize applications and deploy them into. The book will then introduce networks in Kubernetes. We then move on to advanced DevOps skills such as monitoring, logging, and continuous deployment in Kubernetes. It will proceed to introduce permission control for Kubernetes resources via attribute-based access control and role-based access control. The final stage of the book will cover deploying and managing your container clusters on the popular public cloud Amazon Web Services and Google Cloud Platform. At the end of the book, other orchestration frameworks, such as Docker Swarm mode, Amazon ECS, and Apache Mesos will be discussed.

Style and approach

Readers will be taken through fundamental DevOps skills and Kubernetes concept and administration with detailed examples. It introduces comprehensive DevOps topics, including microservices, automation tools, containers, monitoring, logging, continuous delivery, and popular public cloud environments. At each step readers will learn how to leverage Kubernetes in their everyday lives and transform their original delivery pipeline for fast and efficient delivery.

Table of contents

  1. Title Page
  2. Copyright
    1. DevOps with Kubernetes
  3. Credits
  4. About the Authors
  5. About the Reviewer
  6. www.PacktPub.com
    1. Why subscribe?
  7. Customer Feedback
  8. Preface
    1. What this book covers
    2. What you need for this book
    3. Who this book is for
    4. Conventions
    5. Reader feedback
    6. Customer support
      1. Downloading the example code
      2. Downloading the color images of this book
      3. Errata
      4. Piracy
      5. Questions
  9. Introduction to DevOps
    1. Software delivery challenges
      1. Waterfall and physical delivery
      2. Agile and electrical delivery
      3. Software delivery on the cloud
      4. Continuous Integration
      5. Continuous Delivery
        1. Configuration management
        2. Infrastructure as code
        3. Orchestration
    2. Trend of microservices
      1. Modular programming
      2. Package management
      3. MVC design pattern
      4. Monolithic application
      5. Remote Procedure Call
      6. RESTful design
      7. Microservices
    3. Automation and tools
      1. Continuous Integration tool
      2. Continuous Delivery tool
      3. Monitoring and logging tool
      4. Communication tool
      5. Public cloud
    4. Summary
  10. DevOps with Container
    1. Understanding container
      1. Resource isolation
      2. Linux container concept
      3. Containerized delivery
      4. Getting started with container
        1. Installing Docker for Ubuntu
        2. Installing Docker for CentOS
        3. Installing Docker for macOS
    2. Container life cycle
      1. Docker basics
      2. Layer, image, container, and volume
      3. Distributing images
      4. Connect containers
    3. Working with Dockerfile
      1. Writing your first Dockerfile
      2. Dockerfile syntax
      3. Organizing a Dockerfile
    4. Multi-containers orchestration
      1. Piling up containers
      2. Docker Compose overview
      3. Composing containers
    5. Summary
  11. 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. Interaction between Kubernetes master and nodes
    2. Getting started with Kubernetes
      1. Preparing the environment
      2. kubectl
      3. Kubernetes resources
        1. Kubernetes objects
          1. Namespace
          2. Name
          3. Label and selector
          4. Annotation
          5. Pods
          6. ReplicaSet (RS) and ReplicationController (RC)
          7. Deployments
          8. Services
          9. Volumes
          10. Secrets
          11. ConfigMap
          12. Using ConfigMap via volume
          13. Using ConfigMap via environment variables
    3. Multi-containers orchestration
    4. Summary
  12. Working with Storage and Resources
    1. Kubernetes volume management
      1. Container volume lifecycle
      2. Sharing volume between containers within a pod
      3. Stateless and stateful applications
      4. Kubernetes Persistent Volume and dynamic provisioning
        1. Persistent Volume claiming the abstraction layer
        2. Dynamic Provisioning and StorageClass
      5. A problem case of ephemeral and persistent setting
      6. Replicating pods with a Persistent Volume using StatefulSet
      7. Persistent Volume example
        1. Elasticsearch cluster scenario
          1. Elasticsearch master node
          2. Elasticsearch master-eligible node
          3. Elasticsearch data node
          4. Elasticsearch coordinating node
    2. Kubernetes resource management
      1. Resource Quality of Service
      2. Configuring the BestEffort pod
      3. Configuring as the Guaranteed pod
      4. Configuring as Burstable pod
      5. Monitoring resource usage
    3. Summary
  13. Network and Security
    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. Summary
  14. Monitoring and Logging
    1. Inspecting a container
      1. Kubernetes dashboard
    2. Monitoring in Kubernetes
      1. Application
      2. Host
      3. External resources
      4. Container
      5. Kubernetes
      6. Getting monitoring essentials for Kubernetes
    3. Hands-on monitoring
      1. Meeting Prometheus
      2. Deploying Prometheus
      3. Working with PromQL
      4. Discovering targets in Kubernetes
      5. Gathering data from Kubernetes
      6. Seeing 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 logs
      2. Ingesting Kubernetes events
      3. Logging with Fluentd and Elasticsearch
    5. Extracting metrics from logs
    6. Summary
  15. 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
        1. Steps explained
          1. env
          2. script
          3. after_success
          4. deploy
    3. Gaining deeper understanding of pods
      1. Starting a pod
        1. Liveness and readiness probes
        2. Init containers
      2. Terminating a pod
        1. Handling SIGTERM
          1. SIGTERM is not forwarded to the container process
          2. SIGTERM doesn't invoke the termination handler
      3. Container lifecycle hooks
      4. Placing pods
    4. Summary
  16. Cluster Administration
    1. Kubernetes namespaces
      1. Default namespaces
      2. Create a new namespace
        1. Context
          1. Create a context
          2. Switch the current context
    2. ResourceQuota
      1. Create a ResourceQuota for a namespace
        1. Request pods with default compute resource limits
      2. Delete a namespace
    3. Kubeconfig
    4. Service account
    5. Authentication and authorization
      1. Authentication
        1. Service account authentication
        2. User account authentication
      2. Authorization
      3. Attribute-based access control (ABAC)
      4. Role-based access control (RBAC)
        1. Roles and ClusterRoles
        2. RoleBinding and ClusterRoleBinding
    6. Admission control
      1. Namespace life cycle
      2. LimitRanger
      3. Service account
      4. PersistentVolumeLabel
      5. DefaultStorageClass
      6. ResourceQuota
      7. DefaultTolerationSeconds
        1. Taints and tolerations
      8. PodNodeSelector
      9. AlwaysAdmit
      10. AlwaysPullImages
      11. AlwaysDeny
      12. DenyEscalatingExec
      13. Other admission controller plugins
    7. Summary
  17. 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 gateway and NAT-GW
        3. Security group
        4. EC2 and EBS
        5. Route 53
        6. ELB
        7. S3
    2. Setup Kubernetes on AWS
      1. Install kops
      2. Run kops
      3. Kubernetes cloud provider
        1. L4 LoadBalancer
        2. L7 LoadBalancer (ingress)
        3. StorageClass
      4. Maintenance Kubernetes cluster by kops
    3. Summary
  18. Kubernetes on GCP
    1. Introduction to GCP
      1. GCP components
        1. VPC
        2. Subnets
        3. Firewall rules
        4. VM instance
        5. Load balancing
          1. Health check
          2. Backend service
          3. Creating a LoadBalancer
        6. Persistent Disk
    2. Google Container Engine (GKE)
      1. Setting up your first Kubernetes cluster on GKE
      2. Node pool
      3. Multi zone cluster
      4. Cluster upgrade
      5. Kubernetes cloud provider
        1. StorageClass
        2. L4 LoadBalancer
        3. L7 LoadBalancer (ingress)
    3. Summary
  19. What's Next
    1. Exploring the possibilities of Kubernetes
      1. Mastering Kubernetes
        1. Job and CronJob
        2. Affinity and anti-affinity between pods and nodes
        3. Auto-scaling of pods
        4. Prevention and mitigation of pod disruptions
        5. Kubernetes federation
        6. Cluster add-ons
      2. Kubernetes and communities
        1. Kubernetes incubator
        2. Helm and charts
    2. Gravitating towards a future infrastructure
      1. Docker swarm mode
      2. Amazon EC2 container service
      3. Apache Mesos
    3. Summary

Product information

  • Title: DevOps with Kubernetes
  • Author(s): Hideto Saito, Hui-Chuan Chloe Lee, Cheng-Yang Wu
  • Release date: October 2017
  • Publisher(s): Packt Publishing
  • ISBN: 9781788396646