Reading Time: 2 minutes read
Pod resources are the smallest components in the cluster eco-system that can be deployed.
A pod is an abstract way to define a group of containers (ie Docker) with shared storage/network that shares the same namespace and acts together as “one unit”. The contents of pods are tightly coupled and are always co-located and co-scheduled together. Pods are not stateful in the sense that they can be destroyed and spawned again continuing on processing work without interruption.
As seen in the illustration below can we see that a pod has two containers where a web server is processing data and writing logs to a shared volume in the pods namespace and a so called sidecar container pulls the log data from the volume and processes it further to some external logging back end server such as Elasticsearch. This pod can be scaled into multiple identical pods that processes data to reduce workload on-demand and this is called Horizontal Pod Autoscaling (HPA). More on this in a later article!

Example: Nginx Pod
In this example will we create a pod in our Kubernetes cluster. Creating pods can be done i multiple ways but for the sake of simplicity will create a YAML file named nginx.yaml
that defines a pod running an Nginx container.
---
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:
- name: nginx
image: nginx
Now that we have defined our pod in YAML lets apply it to the cluster.
kubectl apply -f nginx.yaml
More information about pods and its concept can be found on the official Kubernetes documentation