Overview

appendix E Docker and Kubernetes

This appendix introduces the container and cluster tools used later in the book to run API services and gateways locally and in orchestration environments. It explains that Docker packages software into portable containers built from images, with a container runtime such as the Docker Engine turning an image into a running container. Unlike virtual machines, containers virtualize the operating system layer rather than the hardware, giving applications isolated access to resources while making them easier to build, test, and deploy.

The text then shows how Docker Desktop and Docker Compose support working with multiple related services at once. Docker Compose uses a YAML file to define an application’s containers and lets you start, inspect, and stop them with simple commands. In the example, a compose file brings up the Kong API gateway and the Apicurio API registry, which are used as part of the deployment pipeline and can be run locally in the background for testing.

The appendix also gives a concise introduction to Kubernetes as the platform for orchestrating containerized applications across a cluster. It describes the control plane, worker nodes, pods, deployments, services, ingress objects, and controllers, emphasizing the desired-state model expressed through manifests with fields such as apiVersion, kind, metadata, and spec. Finally, it notes how kubectl is used to manage Kubernetes resources and provides basic installation and verification steps for different operating systems.

Figure E.1 Container runtimes like the Docker Engine provide OS-level virtualization and run containers that have access to isolated system resources.
figure
Figure E.2 Kubernetes architecture showing the control plane and worker nodes
figure
Figure E.3 Ingress and service objects route traffic to pods.
figure
Figure E.4 Controllers reconcile the desired and actual states of Kubernetes objects.
figure

E.6 Installing a local Kubernetes cluster with minikube

minikube (https://github.com/kubernetes/minikube) is a simple way to get started with Kubernetes for local development. It deploys a simple Kubernetes cluster containing only one node on your local machine. minikube runs on macOS, Linux, and Windows. Make sure you’ve installed Docker before you install minikube.

For macOS, you can install minikube with Homebrew by running brew install minikube. For Windows, install it using the Chocolatey package manager by running choco install minikube. For Linux, see https://minikube.sigs.k8s.io/docs/start for instructions on how to install minikube for your flavor of Linux.

After installation, start minikube by running minikube start. Now you can check that minikube is running by opening the minikube dashboard, which is a web-based Kubernetes user interface that gives you an overview of applications running in your cluster. Do so by running the command minikube dashboard, and the dashboard should open up in your browser.

FAQ

What is Docker in the context of API delivery?Docker is an open platform that uses OS-level virtualization to package software into containers. Each container includes the code, system tools, libraries, and settings needed to run an application consistently across environments.
How is a container different from a virtual machine?Containers virtualize the operating system rather than the underlying hardware. This makes them lighter and faster than virtual machines, while still isolating CPU, memory, storage, and network resources.
What is a container image?A container image is a static file that contains everything needed to create a running container, including application code, libraries, tools, and configuration settings.
What is Docker Compose used for?Docker Compose is used to manage multiple Docker containers together. It lets you define services in a YAML file and start, stop, inspect, and view logs for them with simple commands.
How do you start the services defined in the chapter’s Compose file?You can start the services in the background with:
docker compose --file chapter9/compose.yaml up --detach
How do you list and stop Docker Compose services?To list running services, use:
docker compose --file chapter9/compose.yaml ls
To stop services and remove their containers, use:
docker compose --file chapter9/compose.yaml down
What is Kubernetes?Kubernetes, or K8s, is an open source platform for orchestrating the distribution, scheduling, and execution of applications in a computer cluster. It helps users deploy and manage containerized applications across multiple machines.
What are the main parts of a Kubernetes cluster?A Kubernetes cluster has a control plane and worker nodes. The control plane manages the cluster, while worker nodes run the containerized applications. Each node has a kubelet and a container runtime.
What is the difference between a pod, deployment, and service in Kubernetes?A pod is the basic unit that runs one or more containers with shared resources. A deployment defines the desired state of pods, including replica count and update strategy. A service provides a stable internal IP and routes traffic to a set of pods.
What are the required fields in a Kubernetes manifest?A Kubernetes manifest must include apiVersion, kind, metadata, and spec. These define the API version, object type, identifying information, and desired state of the resource.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Automating API Delivery Automating API Delivery ebook for free
Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Automating API Delivery Automating API Delivery ebook for free
Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Automating API Delivery Automating API Delivery ebook for free