0%

Book Description

Learn how to automate and manage your Linux containers and improve the overall performance of your system

About This Book

  • Are you using containers in your organization and want to better manage, scale, and orchestrate apps on the container? Use the recipes in the book to find a reliable solution from experts
  • This is the first and only book on the market on Kubernetes, and it will show how to manage your containers in production using Kubernetes
  • Buy this book, simply follow the recipes, and you will be the master of your Linux containers

Who This Book Is For

The book is aimed at system administrators who have intermediate level of knowledge with Kubernetes and want to better manage their applications deployed over containers. Also, it will help those administrators who want to maintain and scale applications on these containers.

What You Will Learn

  • Get to know how to build your own container cluster
  • Deploy and manage highly scalable applications using Kubernetes
  • Discover how to build high availability Kubernetes clusters
  • Find out how to build a continuous delivery pipeline for your application
  • Track metrics and logs for every container running in your cluster
  • Streamline the way you deploy and manage your applications with large-scale container orchestration

In Detail

Kubernetes is Google's solution to managing a cluster of containers. Kubernetes provides a declarative API to manage clusters while giving us a lot of flexibility. This book will provide you with recipes to better manage containers in different scenarios in production using Kubernetes.

We will start by giving you a quick brush up on how Kubernetes works with containers along with an overview of the main Kubernetes features such as Pods, Replication Controllers, and more. Next, we will teach you how to create Kubernetes cluster and how to run programs on Kubernetes. We'll explain features such as High Availability Kubernetes master setup, using Kubernetes with Docker, and orchestration with Kubernetes using AWS. Later, will show you how to use Kubernetes-UI, and how to set up and manage Kubernetes clusters on the cloud and bare metal.

Upon completion of this book, you will be able use Kubernetes in production and will have a better understanding of how to manage your containers using Kubernetes.

Style and approach

This recipe-based book precisely teaches you how to use Kubernetes in production and how to better manage your containers using Kubernetes.

Table of Contents

  1. Kubernetes Cookbook
    1. Table of Contents
    2. Kubernetes Cookbook
    3. Credits
    4. About the Authors
    5. About the Reviewer
    6. www.PacktPub.com
      1. eBooks, discount offers, and more
        1. Why Subscribe?
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Sections
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      5. Conventions
      6. Reader feedback
      7. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Building Your Own Kubernetes
      1. Introduction
      2. Exploring architecture
        1. Getting ready
        2. How to do it…
          1. Kubernetes master
            1. API server (kube-apiserver)
            2. Scheduler (kube-scheduler)
            3. Controller manager (kube-controller-manager)
            4. Command Line Interface (kubectl)
          2. Kubernetes node
            1. kubelet
            2. Proxy (kube-proxy)
        3. How it works…
          1. etcd
          2. Overlay network
            1. Flannel
        4. See also
      3. Preparing your environment
        1. Getting ready
          1. Hardware resource
          2. Operating system
        2. How to do it…
          1. Kubernetes master
          2. Kubernetes nodes
          3. etcd
        3. See also
      4. Building datastore
        1. How to do it…
          1. Red Hat Enterprise Linux 7 or CentOS 7
          2. Ubuntu Linux 15.10 Wily Werewolf
          3. Other Linux
            1. Download a binary
            2. Creating a user
            3. Install etcd
        2. How it works…
          1. Auto startup script
            1. Startup script (systemd)
            2. Startup script (init)
          2. Configuration
        3. See also
      5. Creating an overlay network
        1. Getting ready
          1. Installation
            1. CentOS 7 or Red Hat Enterprise Linux 7
            2. Other Linux options
        2. How to do it…
          1. Flannel networking configuration
          2. Integrating with Docker
        3. How it works…
        4. See also
      6. Configuring master
        1. Getting ready
        2. How to do it…
          1. Installation
            1. CentOS 7 or Red Hat Enterprise Linux 7
            2. Adding daemon dependency
            3. Other Linux options
          2. Verification
        3. See also
      7. Configuring nodes
        1. Getting ready
        2. How to do it…
          1. Installation
            1. CentOS 7 or Red Hat Enterprise Linux 7
            2. Other Linux options
          2. Verification
        3. See also
      8. Run your first container in Kubernetes
        1. Getting ready
        2. How to do it…
          1. Running an HTTP server (nginx)
          2. Exposing the port for external access
          3. Stopping the application
        3. How it works…
        4. See also
    9. 2. Walking through Kubernetes Concepts
      1. Introduction
      2. An overview of Kubernetes control
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      3. Working with pods
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      4. Working with a replication controller
        1. Getting ready
        2. How to do it…
          1. Creating a replication controller
          2. Getting information of a replication controller
          3. Changing the configuration of a replication controller
          4. Removing a replication controller
        3. How it works…
        4. See also
      5. Working with services
        1. Getting ready
        2. How to do it…
          1. Creating services for different resources
            1. Creating a service for a pod
            2. Creating a service for the replication controller and adding an external IP
            3. Creating a no-selector service for an endpoint
            4. Creating a service with session affinity based on another service
          2. Creating a service in a different type
            1. Creating a service in NodePort type
          3. Deleting a service
        3. How it works…
        4. See also
      6. Working with volumes
        1. Getting ready
        2. How to do it…
          1. emptyDir
          2. hostPath
          3. nfs
          4. glusterfs
          5. iscsi
          6. flocker
          7. rbd
          8. gitRepo
          9. awsElasticBlockStore
          10. gcePersistentDisk
          11. downwardAPI
        3. There's more…
          1. PersistentVolume
        4. See also
      7. Working with secrets
        1. Getting ready
        2. How to do it…
          1. Creating a secret
          2. Picking up secret in the container
          3. Deleting a secret
        3. How it works…
        4. There's more…
        5. See also
      8. Working with names
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      9. Working with namespaces
        1. Getting ready
        2. How to do it…
          1. Changing the default namespace
          2. Deleting a namespace
        3. There's more…
          1. Deleting LimitRange
        4. See also
      10. Working with labels and selectors
        1. Getting ready
        2. How to do it…
          1. Linking service with a replication controller by using label selectors
        3. There's more…
        4. See also
    10. 3. Playing with Containers
      1. Introduction
      2. Scaling your containers
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      3. Updating live containers
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Forwarding container ports
        1. Getting ready
        2. How to do it…
          1. Container-to-container communications
          2. Pod-to-pod communications
          3. Pod-to-service communications
          4. External-to-internal communications
        3. See also
      5. Ensuring flexible usage of your containers
        1. Getting ready
        2. How to do it…
          1. Pod as a job
            1. Creating a job with multiple pods running
          2. Pod as a daemon set
            1. Running the daemon set only on specific nodes
        3. How it works…
        4. See also
      6. Working with configuration files
        1. Getting ready
          1. YAML
          2. JSON
        2. How to do it…
        3. How it works…
          1. Pods
          2. Replication controllers
          3. Services
        4. See also
    11. 4. Building a High Availability Cluster
      1. Introduction
      2. Clustering etcd
        1. Getting ready
        2. How to do it…
          1. Static
          2. etcd discovery
        3. See also
      3. Building multiple masters
        1. Getting ready
        2. How to do it…
          1. Preparing multiple master nodes
          2. Setting up kubelet in master
          3. Getting the configuration files ready
          4. Starting the kubelet service and turning daemons on!
        3. How it works…
        4. See also
    12. 5. Building a Continuous Delivery Pipeline
      1. Introduction
      2. Moving monolithic to microservices
        1. Getting ready
        2. How to do it…
          1. Microservices
          2. Frontend WebUI
        3. How it works…
          1. Microservices
          2. Frontend WebUI
        4. See also
      3. Integrating with Jenkins
        1. Getting ready
          1. Install a Jenkins server which can build a Docker program
        2. How to do it…
          1. Create your Jenkins project
          2. Run a program testing
          3. Deploying a program
        3. How it works…
        4. There's more…
        5. See also
      4. Working with the private Docker registry
        1. Getting ready
        2. How to do it…
        3. How it works…
          1. Alternatives
            1. Docker Trusted Registry
            2. Nexus Repository Manager
            3. Amazon EC2 Container Registry
        4. See also
      5. Setting up the Continuous Delivery pipeline
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
    13. 6. Building Kubernetes on AWS
      1. Introduction
      2. Building the Kubernetes infrastructure in AWS
        1. Getting ready
        2. How to do it…
          1. VPC and subnets
          2. Internet Gateway and NAT
          3. Route Table
          4. Security group
        3. How it works…
        4. See also
      3. Managing applications using AWS OpsWorks
        1. Getting ready
        2. How to do it…
          1. The OpsWorks stack
          2. The OpsWorks layer
          3. Adjusting the IAM role
          4. The OpsWorks instance
        3. How it works…
        4. See also
      4. Auto-deploying Kubernetes through Chef recipes
        1. Getting ready
          1. Creating ELB and its security groups
          2. Creating an OpsWorks stack
          3. Creating application layers
        2. How to do it…
          1. Stack configuration for custom recipes
          2. Recipes for etcd
          3. Recipes for the Kubernetes master
          4. Recipes for the Kubernetes node
          5. Starting the instances
        3. See also
      5. Using AWS CloudFormation for fast provisioning
        1. Getting ready
        2. How to do it…
          1. Creating a network infrastructure
          2. Creating OpsWorks for application management
        3. See also
    14. 7. Advanced Cluster Administration
      1. Introduction
      2. Advanced settings in kubeconfig
        1. Getting ready
        2. How to do it…
          1. Setting a new credential
          2. Setting a new cluster
          3. Setting and changing the current context
          4. Cleaning up kubeconfig
        3. See also
      3. Setting resource in nodes
        1. Getting ready
        2. How to do it…
          1. Managing node capacity
          2. Managing computing resources in a pod
        3. See also
      4. Playing with WebUI
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      5. Working with a RESTful API
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      6. Authentication and authorization
        1. Getting ready
        2. How to do it…
          1. Enabling authentication for an API call
            1. Basic authentication of etcd
            2. Basic authentication of the Kubernetes master
          2. Making use of user authorization
        3. See also
    15. 8. Logging and Monitoring
      1. Introduction
      2. Collecting application logs
        1. Getting ready
          1. Elasticsearch
        2. How to do it…
          1. Logstash
          2. Startup script
          3. Dockerfile
          4. Docker build
          5. Kubernetes replication controller and service
          6. Kibana
        3. How it works…
        4. See also
      3. Working with Kubernetes logs
        1. Getting ready
        2. How to do it…
        3. See also
      4. Working with etcd log
        1. Getting ready
        2. How to do it…
        3. See also
      5. Monitoring master and node
        1. Getting ready
          1. Updating Kubernetes to the latest version: 1.2.1
          2. Setting up the DNS server
            1. Start the server using templates
            2. Enable Kubernetes DNS in kubelet
        2. How to do it…
          1. Installing a monitoring cluster
          2. Introducing the Grafana dashboard
            1. Creating a new metric to monitor pods
        3. See also
    16. Index
3.141.199.243