Pods: The Smallest Unit
Learn what a Pod is, its purpose, and how to define and create Pods using YAML manifests.
Pods: The Smallest Unit is a free DevOps Bootcamp lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the DevOps Bootcamp learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Welcome to Pods!
In Kubernetes, the smallest deployable unit is called a Pod. Think of it as the basic building block for your applications.
This lesson will introduce you to Pods, their purpose, and how to create them using YAML.

What is a Pod?
A Pod is an abstraction that represents a single instance of your application. It contains one or more containers, along with shared resources.
- Containers: Usually Docker containers, running your application code.
- Storage: Shared storage volumes for data persistence.
- Network: A unique IP address and network configuration for the Pod.
Why Pods, Not Just Containers?
You might wonder why Kubernetes uses Pods instead of just directly managing containers. Here's why:
- Shared Resources: Containers within a Pod share the same network namespace and can communicate via
localhost. - Co-location: Ensures tightly coupled containers (like an app and its logging sidecar) are always scheduled together on the same node.
- Abstraction: Pods provide a higher-level abstraction, making it easier to manage applications as a whole, rather than individual containers.
Anatomy of a Simple Pod
Most Pods run a single container. This is the most common use case. For example, a Pod could run just an Nginx web server or a Node.js application.
Even with one container, the Pod provides the network and storage context, making it a complete unit for deployment.
Defining Pods with YAML
Kubernetes objects, including Pods, are typically defined using YAML (YAML Ain't Markup Language) files. These files describe the desired state of your resources.
A basic Pod YAML includes:
apiVersion: The Kubernetes API version.kind: The type of Kubernetes object (e.g.,Pod).metadata: Information like the Pod'snameandlabels.spec: The desired state, including the containers to run.
Example: Nginx Pod YAML
Let's look at a simple YAML definition for a Pod running an Nginx web server.
The spec.containers section defines the container(s) within the Pod, including their name, image, and ports.
apiVersion: v1
kind: Pod
metadata:
name: nginx-pod
labels:
app: web
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80Creating Your First Pod
To create a Pod from a YAML file, you use the kubectl apply command. This command tells Kubernetes to create or update resources based on your definition.
First, save the previous YAML content into a file named nginx-pod.yaml.
kubectl apply -f nginx-pod.yamlChecking Pod Status
After applying the YAML, you can check the status of your Pod using kubectl get pod. It should show the Pod in a Running state.
For more detailed information, including events and container status, use kubectl describe pod.
kubectl get pod nginx-pod
kubectl describe pod nginx-podMulti-Container Pods (Sidecars)
While single-container Pods are common, a Pod can also house multiple containers. These are usually tightly coupled and share resources.
A common pattern is a 'sidecar' container, which runs alongside the main application container to provide auxiliary services like logging, monitoring, or data synchronization.
We'll explore this pattern in more detail in a future lesson!
Pod Definition Check
Which of the following is NOT a required top-level field in a basic Kubernetes Pod YAML definition?
Recap: Pods - The Foundation
You've learned that Pods are the smallest deployable units in Kubernetes, encapsulating containers, storage, and network resources.
- Pods abstract containers to enable shared resources and co-location.
- YAML files define Pods using
apiVersion,kind,metadata, andspec. - You create Pods with
kubectl apply -f <filename>and inspect them withkubectl get podandkubectl describe pod.
Next, we'll dive into the lifecycle and states of these fundamental building blocks!
Frequently asked questions
Is the “Pods: The Smallest Unit” lesson free?
Yes — the full text of “Pods: The Smallest Unit” is free to read here on the web, and the DevOps Bootcamp course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the DevOps Bootcamp course, upgrade to CoddyKit PRO.
What will I learn in “Pods: The Smallest Unit”?
Learn what a Pod is, its purpose, and how to define and create Pods using YAML manifests. You practise DevOps Bootcamp with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start DevOps Bootcamp?
No prior experience is required. DevOps Bootcamp on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Pods: The Smallest Unit” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this DevOps Bootcamp lesson?
Yes. Every DevOps Bootcamp lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Pods: The Smallest Unit
- Pod Lifecycle and States
- Multi-Container Pods (Sidecars)
- Init Containers and Startup Ordering