Understanding Pods in Kubernetes

Β· 5 min

Pods in Kubernetes – A Practical Introduction

When learning Kubernetes, the first and most important concept to understand is the Pod. It is the base unit. Without understanding Pods properly, it is hard to work with other Kubernetes objects like Deployments, Services, or Jobs.

In this post, I will explain what a Pod is, how it behaves, how to create it, and how to work with it.

What is a Pod?

A Pod is the smallest deployable object in Kubernetes. It wraps one or more containers. In most cases, one Pod runs one container. But sometimes, you may need to run two or more containers inside one Pod. All containers in a Pod share:

This means they can talk to each other like they are on the same machine, and they always run together on the same node.

When to Use Multiple Containers in a Pod

This is rare, but sometimes useful. For example:

Pod Lifecycle – What Happens to a Pod

A Pod goes through these states:

You can check status with:

kubectl get pods

To see more detail:

kubectl describe pod <pod-name>

Creating a Pod

With a command

kubectl run myapp --image=nginx

This creates a Pod that runs nginx.

With a YAML file

Example YAML:

apiVersion: v1
kind: Pod
metadata:
  name: mypod
  labels:
    app: demo
spec:
  containers:
  - name: mycontainer
    image: nginx

To apply it:

kubectl apply -f pod.yaml

Useful Pod Concepts

Troubleshooting Pods

Some common commands:

If the Pod is stuck, check Events section in describe output.

Final Thoughts

Pods are the core building block in Kubernetes. Once you understand how they work, many other parts of the system will start to make sense. Practice creating, modifying, and deleting Pods often. That’s how you get comfortable working with them.

Start simple, and slowly build up.