Containers and pods
Let’s clear up some terminology before getting into the detail.
We sometimes use the terms container and pod to mean the same thing. However, a pod is actually a thin wrapper around one or more containers and is a mandatory requirement for any container that wants to run on Kubernetes. This means containers must be wrapped in a pod if they want to run on Kubernetes. The following extremely simple YAML file defines a pod with a single container.
1 apiVersion: v1
2 kind: Pod
3 metadata:
4 name: kcna-pod
5 labels:
6 project: kcna-book
7 spec:
8 containers: <<==== Container is defined below here
9 - name: kcna-container
10 image: <container-image-goes-here>
Lines 1-7 give the pod and name and a label. Lines 8-10 show the container definition embedded within the overall pod definition. As the container is embedded within the pod definition, we say the pod “wraps the container”.
As well as...