Getting Started with Kubernetes - Second Edition

Book description

Learn how to schedule and run application containers using Kubernetes.

About This Book

  • Get well-versed with the fundamentals of Kubernetes and get it production-ready for deployments

  • Confidently manage your container clusters and networks using Kubernetes

  • This practical guide will show you container application examples throughout to illustrate the concepts and features of Kubernetes

  • Who This Book Is For

    This book is for developers, sys admins, and DevOps engineers who want to automate the deployment process and scale their applications. You do not need any knowledge about Kubernetes.

    What You Will Learn

  • Download, install, and configure the Kubernetes codebase

  • Understand the core concepts of a Kubernetes cluster

  • Be able to set up and access monitoring and logging for Kubernetes clusters

  • Set up external access to applications running in the cluster

  • Understand how CoreOS and Kubernetes can help you achieve greater performance and container implementation agility

  • Run multiple clusters and manage from a single control plane

  • Explore container security as well as securing Kubernetes clusters

  • Work with third-party extensions and tools

  • In Detail

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

    This book will give you a complete understanding of Kubernetes and how to get a cluster up and running. You will develop an understanding of the installation and configuration process. The book will then focus on the core Kubernetes constructs such as pods, services, replica sets, replication controllers, and labels. You will also understand how cluster level networking is done in Kubernetes.

    The book will also show you how to manage deployments and perform updates with minimal downtime. Additionally, you will learn about operational aspects of Kubernetes such as monitoring and logging. Advanced concepts such as container security and cluster federation will also be covered. Finally, you will learn about the wider Kubernetes ecosystem with OCP, CoreOS, and Tectonic and explore the third-party extensions and tools that can be used with Kubernetes.

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

    Style and approach

    This straightforward guide will help you understand how to move your container applications into production through best practices and a step-by-step walkthrough tied to real-world operational strategies.

    Table of contents

    1. 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
    2. Introduction to Kubernetes
      1. A brief overview of containers
        1. What is a container?
      2. Why are containers so cool?
        1. The advantages of Continuous Integration/Continuous Deployment
        2. Resource utilization
      3. Microservices and orchestration
        1. Future challenges
      4. The birth of Kubernetes
      5. Our first cluster
        1. Kubernetes UI
        2. Grafana
        3. Command line
        4. Services running on the master
        5. Services running on the minions
        6. Tear down cluster
      6. Working with other providers
        1. Resetting the cluster
        2. Modifying kube-up parameters
        3. Alternatives to kube-up.sh
        4. 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
      7. Summary
        1. References
    3. Pods, Services, Replication Controllers, and Labels
      1. The architecture
        1. Master
        2. Node (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
        1. References
    4. Networking, Load Balancers, and Ingress
      1. Kubernetes networking
        1. Networking options
        2. Networking comparisons
          1. Docker
          2. Docker user-defined networks
          3. Weave
          4. Flannel
          5. Project Calico
          6. Canal
        3. Balanced design
      2. 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. Migrations, multicluster, and more
        9. Custom addressing
      3. Service discovery
      4. DNS
      5. Multitenancy
        1. Limits
      6. A note on resource usage
      7. Summary
        1. References
    5. Updates, Gradual Rollouts, and Autoscaling
      1. Example set up
      2. Scaling up
      3. Smooth updates
      4. Testing, releases, and cutovers
      5. Application autoscaling
      6. Scaling a cluster
        1. Autoscaling
        2. Scaling up the cluster on GCE
        3. Scaling up the cluster on AWS
        4. Scaling manually
      7. Summary
    6. Deployments, Jobs, and DaemonSets
      1. Deployments
        1. Scaling
        2. Updates and rollouts
          1. History and rollbacks
        3. Autoscaling
      2. Jobs
        1. Other types of jobs
          1. Parallel jobs
          2. Scheduled jobs
      3. DaemonSets
      4. Node selection
      5. Summary
        1. References
    7. Storage and Running Stateful Applications
      1. Persistent storage
        1. Temporary disks
        2. Cloud volumes
          1. GCE persistent disks
          2. AWS Elastic Block Store
        3. Other storage options
        4. PersistentVolumes and StorageClasses
      2. StatefulSets
        1. A stateful example
      3. Summary
        1. References
    8. Continuous Delivery
      1. Integrating with continuous delivery pipeline
      2. Gulp.js
        1. Prerequisites
        2. Gulp build example
      3. Kubernetes plugin for Jenkins
        1. Prerequisites
        2. Installing plugins
          1. Configuring the Kubernetes plugin
      4. Bonus fun
      5. Summary
    9. Monitoring and Logging
      1. Monitoring operations
      2. Built-in monitoring
        1. Exploring Heapster
        2. Customizing our dashboards
      3. FluentD and Google Cloud Logging
        1. FluentD
      4. Maturing our monitoring operations
        1. GCE (StackDriver)
          1. Sign-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
      5. Summary
        1. References
    10. Cluster Federation
      1. Introduction to federation
      2. 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. Other federated resources
      3. True multi-cloud
      4. Summary
    11. 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. Pod security policies and context
          1. Enabling beta APIs
          2. Creating a PodSecurityPolicy
          3. Creating a pod with a PodSecurityContext
          4. Clean up
        3. Additional considerations
      4. Securing sensitive application data (secrets)
      5. Summary
        1. References
    12. Extending Kubernetes with OCP, CoreOS, and Tectonic
      1. The importance of standards
      2. The Open Container Initiative
      3. Cloud Native Computing Foundation
      4. Standard container specification
      5. CoreOS
        1. rkt
        2. etcd
      6. Kubernetes with CoreOS
      7. Tectonic
        1. Dashboard highlights
      8. Summary
        1. References
    13. Towards Production Ready
      1. Ready for production
        1. Ready, set, go
      2. Third-party companies
        1. Private registries
        2. Google Container Engine
        3. Azure Container Service
        4. ClusterHQ
        5. Portworx
        6. Shippable
        7. Twistlock
        8. AquaSec
        9. Mesosphere (Kubernetes on Mesos)
        10. Deis
        11. OpenShift
      3. Where to learn more?
      4. Summary

    Product information

    • Title: Getting Started with Kubernetes - Second Edition
    • Author(s): Jonathan Baier
    • Release date: May 2017
    • Publisher(s): Packt Publishing
    • ISBN: 9781787283367