Understanding Kubernetes pods
Kubernetes pods are the basic building blocks of a Kubernetes application. A pod contains one or more containers, and all containers within a pod are always scheduled in the same host. Usually, there is a single container within a pod, but there are use cases where you need to schedule multiple containers in a single pod.
It takes a while to digest why Kubernetes started with the concept of pods in the first place instead of using containers, but there are reasons for that, and you will appreciate this as you gain more experience with the tool. For now, let’s look at a simple example of a pod and how to schedule it in Kubernetes.
Running a pod
We will start by running an NGINX container in a pod using simple imperative commands. We will then look at how we can do this declaratively.
To access the resources for this section, cd
into the following directory:
$ cd ~/modern-devops/ch5/pod/
To run a pod with a single NGINX container...