liveBook · Manning

Chapter 3: Deploying your first application on Kubernetes

What you will learn in chapter 3 of Kubernetes in Action, Second Edition

This chapter introduces the upcoming steps of setting up a Kubernetes cluster, using kubectl, and deploying the container created in the previous chapter.

After this chapter you will be able to

What it builds on

Section by section

Introduction

This chapter introduces the upcoming steps of setting up a Kubernetes cluster, using kubectl, and deploying the container created in the previous chapter.

3.1 Deploying a Kubernetes cluster

This section explains why setting up a Kubernetes cluster can be difficult and identifies simpler starting options for newcomers.

Key terms: multi-node Kubernetes cluster, physical or virtual machines (VMs), network setup, Docker Desktop, Minikube, Kubernetes in Docker (Kind), Google Kubernetes Engine, managed Kubernetes

3.1.1 Using the built-in Kubernetes cluster in Docker Desktop

This subsection shows how to enable Docker Desktop’s single-node Kubernetes cluster, where its components run, and how to explore its Linux VM.

Key terms: Docker Desktop, single-node Kubernetes cluster, Enable Kubernetes, Linux virtual machine, Docker Daemon, Kubelet, control plane, docker CLI, host namespaces, --privileged

3.1.2 Running a local cluster using Minikube

This section shows how to start and check a local single-node Kubernetes cluster with Minikube and describes where its components run.

Key terms: Minikube, single node, Linux VM, hypervisor, Docker, minikube start, minikube status, Kubelet, Kubernetes API server, kubectl

3.1.3 Running a local cluster using kind (Kubernetes in Docker)

This section explains how kind runs a local Kubernetes cluster in containers, why that helps development, and how to create and inspect its nodes.

Key terms: kind, cluster node, node containers, multi-node clusters, host OS, development and testing, debug, nsenter, Docker, single-node cluster

3.1.4 Creating a managed cluster with Google Kubernetes Engine

Explains why and how to create a managed multi-node GKE cluster, where its nodes run, and what happens when its worker-node count is scaled down.

Key terms: managed cluster, Google Kubernetes Engine (GKE), Google Cloud SDK, gcloud, region, zone, --num-nodes, worker nodes, Google Compute Engine (GCE), control plane

3.1.5 Creating a cluster using Amazon Elastic Kubernetes Service

This section shows how to create a three-node Amazon EKS cluster with eksctl and inspect a worker node.

Key terms: Amazon Elastic Kubernetes Service (EKS), eksctl, eu-central-1, worker node, --ssh-access, SSH public key, docker ps

3.1.6 Deploying a multi-node cluster from scratch

This subsection advises readers to gain experience with easier cluster deployments before attempting a multi-node Kubernetes cluster from scratch.

Key terms: multi-node cluster, kubeadm, Kubernetes the Hard Way

3.2 Interacting with Kubernetes

Introduces kubectl as the command-line way to interact with a Kubernetes cluster and explains how its requests reach the control plane.

Key terms: kubectl, Kubernetes API server, Kubernetes Control Plane

3.2.1 Setting up kubectl, the Kubernetes command-line client

This section explains how to install kubectl and make frequent command-line use easier with an alias and tab completion.

Key terms: kubectl, kubeconfig, path, kubectl --help, alias, k, ~/.bashrc, doskey, set-alias, tab completion

3.2.2 Configuring kubectl to use a specific Kubernetes cluster

This section explains where kubectl finds its cluster configuration and how to point it to a file elsewhere.

Key terms: kubeconfig, ~/.kube/config, KUBECONFIG environment variable

3.2.3 Using kubectl

Shows how to use kubectl to check cluster connectivity, list nodes, and inspect an object in detail.

Key terms: kubectl cluster-info, API server, kubectl get, nodes, objects, RESTful API, kubectl describe, resource name

3.2.4 Interacting with Kubernetes through web dashboards

This section explains what the Kubernetes web dashboard offers, how it compares with kubectl, and how to access a dashboard in different cluster environments.

Key terms: dashboard, kubectl, resources, Docker Desktop, Kubernetes dashboard, kubectl proxy, authentication token, Minikube, Google Kubernetes Engine, web-based console

3.3 Running your first application on Kubernetes

Introduces two ways to deploy an application to Kubernetes and chooses the simpler imperative approach for a first deployment.

Key terms: declarative approach, JSON or YAML file, imperative commands

3.3.1 Deploying your application

This section deploys a containerized application with a Deployment, introduces pods as Kubernetes’ unit for running containers, and traces how the application starts on a worker node.

Key terms: imperative, kubectl create deployment, Deployment object, desired state, container image, pod, worker node, network namespace, UTS namespace, kubectl get pods

3.3.2 Exposing your application to the world

This section shows how to expose the deployed application through a Service and reach it through an external load balancer or a node port.

Key terms: pod IP address, Service object, LoadBalancer, kubectl expose deployment, LoadBalancer Service, external IP, load balancer, service port, node port, PORT(S)

3.3.3 Horizontally scaling the application

The section shows how to scale a Deployment to three pods, inspect the result, and use a Service to distribute requests among them.

Key terms: Deployment object, replicas, desired state, scaling out, reconcile, kubectl get pods, READY column, Running, -o wide, container image

3.3.4 Understanding the deployed application

This section explains the deployed application’s logical objects and why a Deployment and Service are useful for running and reaching its pods.

Key terms: physical view, logical view, Kubernetes API, Deployment, Pod, Service, replica, containers, Pod object, desired number of replicas

3.4 Summary

Summarizes ways to run a Kubernetes cluster and the kubectl workflow for deploying, scaling, inspecting, and exposing an application.

Where this is used later

Concepts explained in this chapter

← Chapter 2: Understanding containers and containerized applications Chapter 4: Navigating the Kubernetes API and object model →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.