Getting Started with Kubernetes - Third Edition

Book description

Schedule and run application containers using Kubernetes

Key Features

  • Get to grips with a wide range of tools to monitor and secure your deployments
  • Manage your container clusters and networks using Kubernetes
  • Get well-versed with the fundamentals of Kubernetes

Book Description

Kubernetes has continued to grow and achieve broad adoption across various industries, helping you to orchestrate and automate container deployments on a massive scale.

Based on the recent release of Kubernetes 1.12, Getting Started with Kubernetes gives you a complete understanding of how to install a Kubernetes cluster. The book focuses on core Kubernetes constructs, such as pods, services, replica sets, replication controllers, and labels. You will understand cluster-level networking in Kubernetes, and learn to set up external access to applications running in the cluster.

As you make your way through the book, you'll understand how to manage deployments and perform updates with minimal downtime. In addition to this, you will explore operational aspects of Kubernetes , such as monitoring and logging, later moving on to advanced concepts such as container security and cluster federation. You'll get to grips with integrating your build pipeline and deployments within a Kubernetes cluster, and be able to understand and interact with open source projects. In the concluding chapters, you'll orchestrate updates behind the scenes, avoid downtime on your cluster, and deal with underlying cloud provider instability within your cluster.

By the end of this book, you'll have a complete understanding of the Kubernetes platform and will start deploying applications on it.

What you will learn

  • Download, install, and configure the Kubernetes code base
  • Set up and access monitoring and logging for Kubernetes clusters
  • Set up external access to applications running in the cluster
  • Learn how to manage and scale kubernetes with hosted platforms on AWS, Azure, and GCP
  • Run multiple clusters and manage them from a single control plane
  • Discover top tools for deploying and managing a Kubernetes cluster
  • Learn how to get production ready and harden Kubernetes operations, networking, and storage

Who this book is for

Getting Started with Kubernetes is for developers, system administrators, and DevOps engineers who want to automate the deployment process and scale their applications. No prior knowledge of Kubernetes is required.

Publisher resources

Download Example Code

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Getting Started with Kubernetes Third Edition
  3. Dedication
  4. Packt Upsell
    1. Why subscribe?
    2. Packt.com
  5. Contributors
    1. About the authors
    2. About the reviewer
    3. Packt is searching for authors like you
  6. 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
  7. Introduction to Kubernetes
    1. Technical requirements
    2. A brief overview of containers
      1. What is a container?
        1. cgroups
        2. Namespaces 
        3. Union filesystems
    3. Why are containers so cool?
    4. The advantages of Continuous Integration/Continuous Deployment
      1. Resource utilization
    5. Microservices and orchestration
      1. Future challenges
    6. Our first clusters
      1. Running Kubernetes on GCE
      2. Kubernetes UI
      3. Grafana
      4. Command line
      5. Services running on the master
      6. Services running on the minions
      7. Tearing down a cluster
    7. Working with other providers
      1. CLI setup
      2. IAM setup
      3. Cluster state storage
      4. Creating your cluster
        1. Other modes
      5. Resetting the cluster
      6. Investigating other deployment automation
      7. Local alternatives
      8. Starting from scratch
        1. Cluster setup
        2. Installing Kubernetes components (kubelet and kubeadm)
        3. Setting up a master
        4. Joining nodes
        5. Networking
        6. Joining the cluster
    8. Summary
    9. Questions
    10. Further reading
  8. Building a Foundation with Core Kubernetes Constructs
    1. Technical requirements
      1. The Kubernetes system
        1. Nucleus
        2. Application layer
        3. Governance layer
        4. Interface layer
        5. Ecosystem
      2. The architecture
      3. The Master
      4. Cluster state
      5. Cluster nodes
      6. Master
      7. Nodes (formerly minions)
    2. Core constructs
      1. Pods
        1. Pod example
      2. Labels
      3. The container's afterlife
      4. Services
      5. Replication controllers and replica sets
    3. Our first Kubernetes application
      1. More on labels
      2. Replica sets
    4. Health checks
      1. TCP checks
      2. Life cycle hooks or graceful shutdown
    5. Application scheduling
      1. Scheduling example
    6. Summary
    7. Questions
    8. Further reading
  9. Working with Networking, Load Balancers, and Ingress
    1. Technical requirements
    2. Container networking
      1. The Docker approach
        1. Docker default networks
        2. Docker user-defined networks
      2. The Kubernetes approach
      3. Networking options
      4. Networking comparisons
        1. Weave
        2. Flannel
        3. Project Calico
        4. Canal
        5. Kube-router
      5. Balanced design
    3. Advanced services
      1. External services
      2. Internal services
      3. Custom load balancing
      4. Cross-node proxy
      5. Custom ports
      6. Multiple ports
      7. Ingress
      8. Types of ingress
      9. Migrations, multicluster, and more
      10. Custom addressing
    4. Service discovery
    5. DNS
    6. Multitenancy
      1. Limits
    7. A note on resource usage
    8. Summary
    9. Questions
    10. Further reading
  10. Implementing Reliable Container-Native Applications
    1. Technical requirements
    2. How Kubernetes manages state
    3. Deployments
      1. Deployment use cases
      2. Scaling
      3. Updates and rollouts
        1. History and rollbacks
      4. Autoscaling
    4. Jobs
      1. Other types of jobs
        1. Parallel jobs
        2. Scheduled jobs
    5. DaemonSets
    6. Node selection
    7. Summary
    8. Questions
  11. Exploring Kubernetes Storage Concepts
    1. Technical requirements
    2. Persistent storage
      1. Temporary disks
      2. Cloud volumes
        1. GCE Persistent Disks
        2. AWS Elastic Block Store
      3. Other storage options
      4. PersistentVolumes and Storage Classes
      5. Dynamic volume provisioning
    3. StatefulSets
      1. A stateful example
    4. Summary
    5. Questions
    6. Further reading
  12. Application Updates, Gradual Rollouts, and Autoscaling
    1. Technical requirements
    2. Example setup
    3. Scaling up
    4. Smooth updates
    5. Testing, releases, and cutovers
    6. Application autoscaling
    7. Scaling a cluster
      1. Autoscaling
      2. Scaling up the cluster on GCE
      3. Scaling up the cluster on AWS
      4. Scaling manually
    8. Managing applications
      1. Getting started with Helm
    9. Summary
    10. Questions
    11. Further reading
  13. Designing for Continuous Integration and Delivery
    1. Technical requirements
    2. Integrating Kubernetes with a continuous delivery pipeline
    3. gulp.js
      1. Prerequisites
      2. gulp.js build example
    4. The Kubernetes plugin for Jenkins
      1. Prerequisites
      2. Installing plugins
        1. Configuring the Kubernetes plugin
    5. Helm and Minikube
    6. Bonus fun
    7. Summary
    8. Questions
    9. Further reading
  14. Monitoring and Logging
    1. Technical requirements
    2. Monitoring operations
    3. Built-in monitoring
      1. Exploring Heapster
      2. Customizing our dashboards
    4. FluentD and Google Cloud Logging
      1. FluentD
    5. Maturing our monitoring operations
      1. GCE (Stackdriver)
        1. Signing up for GCE monitoring
        2. Alerts
      2. Beyond system monitoring with Sysdig
        1. Sysdig Cloud
          1. Detailed views
          2. Topology views
          3. Metrics
        2. Alerting
        3. The Sysdig command line
        4. The Csysdig command-line UI
      3. Prometheus
        1. Prometheus summary
        2. Prometheus installation choices
        3. Tips for creating an Operator
        4. Installing Prometheus
    6. Summary
    7. Questions
    8. Further reading
  15. Operating Systems, Platforms, and Cloud and Local Providers
    1. Technical requirements
    2. The importance of standards
      1. The OCI Charter
    3. The OCI
      1. Container Runtime Interface
      2. Trying out CRI-O
      3. More on container runtimes
    4. CNCF
    5. Standard container specification
    6. CoreOS
      1. rkt
      2. etcd
    7. Kubernetes with CoreOS
    8. Tectonic
      1. Dashboard highlights
    9. Hosted platforms
      1. Amazon Web Services
      2. Microsoft Azure
      3. Google Kubernetes Engine
    10. Summary
    11. Further reading
  16. Designing for High Availability and Scalability
    1. Technical requirements
    2. Introduction to high availability
      1. How do we measure availability?
        1. Uptime and downtime
          1. Uptime
          2. Downtime
        2. The five nines of availability
    3. HA best practices
      1. Anti-fragility
      2. HA clusters
      3. HA features of the major cloud service providers
      4. HA approaches for Kubernetes
        1. Prerequisites
        2. Setting up
        3. Stacked nodes
        4. Installing workers
    4. Cluster life cycle
      1. Admission controllers
        1. Using admission controllers
      2. The workloads API
      3. Custom resource definitions
        1. Using CRDs
    5. Summary
    6. Questions
    7. Further reading
  17. Kubernetes SIGs, Incubation Projects, and the CNCF
    1. Technical requirements
      1. Setting up Git for contributions
        1. Git's benefits
    2. CNCF structure
      1. What Kubernetes isn't
    3. Kubernetes SIGs
    4. How to get involved
    5. Summary
    6. Questions
    7. Further reading
  18. Cluster Federation and Multi-Tenancy
    1. Technical requirements
    2. Introduction to federation
    3. Why federation?
      1. The building blocks of federation
      2. Key components
      3. Federated services
    4. Setting up federation
      1. Contexts
      2. New clusters for federation
      3. Initializing the federation control plane
      4. Adding clusters to the federation system
      5. Federated resources
      6. Federated configurations
      7. Federated horizontal pod autoscalers
        1. How to use federated HPAs
      8. Other federated resources
        1. Events
        2. Jobs
    5. True multi-cloud
      1. Getting to multi-cloud
        1. Deleting the cluster
    6. Summary
    7. Questions
    8. Further reading
  19. Cluster Authentication, Authorization, and Container Security
    1. Basics of container security
      1. Keeping containers contained 
      2. Resource exhaustion and orchestration security
    2. Image repositories
      1. Continuous vulnerability scanning
      2. Image signing and verification
    3. Kubernetes cluster security
      1. Secure API calls
        1. Secure node communication
        2. Authorization and authentication plugins
        3. Admission controllers
      2. RBAC
      3. Pod security policies and context
        1. Enabling PodSecurityPolicies
      4. Additional considerations
    4. Securing sensitive application data (secrets)
    5. Summary
    6. Questions
    7. Further reading
  20. Hardening Kubernetes
    1. Ready for production
      1. Ready, set, go
    2. Lessons learned from production
      1. Setting limits
      2. Scheduling limits
      3. Memory limit example
      4. Scheduling CPU constraints
      5. CPU constraints example
    3. Securing a cluster
    4. Third-party companies
      1. Private registries
      2. Google Kubernetes Engine
      3. Azure Kubernetes Service
      4. ClusterHQ
      5. Portworx
      6. Shippable
      7. Twistlock
      8. Aqua Sec
      9. Mesosphere (Kubernetes on Mesos)
      10. Deis
      11. OpenShift
    5. Summary
    6. Questions
    7. Further reading
  21. Kubernetes Infrastructure Management
    1. Technical requirements
    2. Planning a cluster
      1. Picking what's right
      2. Securing the cluster
      3. Tuning examples
    3. Upgrading the cluster
      1. Upgrading PaaS clusters
    4. Scaling the cluster
      1. On GKE and AKS
      2. DIY clusters
      3. Node maintenance
    5. Additional configuration options
    6. Summary
    7. Questions
    8. Further reading
  22. Assessments
    1. Chapter 1: Introduction to Kubernetes
    2. Chapter 2: Building a Foundation with Core Kubernetes Constructs
    3. Chapter 3: Working with Networking, Load Balancers, and Ingress
    4. Chapter 4: Implementing Reliable, Container-Native Applications
    5. Chapter 5: Exploring Kubernetes Storage Concepts
    6. Chapter 6: Application Updates, Gradual Rollouts, and Autoscaling
    7. Chapter 7: Designing for Continuous Integration and Delivery
    8. Chapter 8: Monitoring and Logging
    9. Chapter 10: Designing for High Availability and Scalability
    10. Chapter 11: Kubernetes SIGs, Incubation Projects, and the CNCF
    11. Chapter 12: Cluster Federation and Multi-Tenancy
    12. Chapter 13: Cluster Authentication, Authorization, and Container Security
    13. Chapter 14: Hardening Kubernetes
    14. Chapter 15: Kubernetes Infrastructure Management
  23. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Getting Started with Kubernetes - Third Edition
  • Author(s): Jonathan Baier, Jesse White
  • Release date: October 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781788994729