Introduction to Pods

A Pod is the smallest deployable unit in Kubernetes — a wrapper around one or more containers.

You might expect Kubernetes to run containers directly, but it does not. The smallest thing you can deploy is a Pod.

What is a Pod?

A Pod is a group of one or more containers that share:

  • A single IP address — containers in a Pod reach each other on localhost.
  • Storage volumes — they can share files.
  • The same lifecycle — they start and stop together.

Most Pods hold exactly one container. A Pod always runs on a single node; it is never split across machines.

A worker node containing two Pods, each with a containerWorker NodePod (IP 10.1.0.5)container: webPod (IP 10.1.0.6)container: api
Each Pod gets its own IP address and lives on one node.

Pods are cattle, not pets

Pods are meant to be disposable. When one dies, Kubernetes does not repair it — it creates a fresh replacement with a new name and IP. You rarely create bare Pods yourself; instead you use controllers like Deployments (covered later).

Example

Example · bash
# Quickly create a Pod running the nginx web server
kubectl run web --image=nginx

# List Pods and their status
kubectl get pods

# See which node the Pod landed on and its IP
kubectl get pod web -o wide

When to use it

  • A microservices team deploys each service as an individual Pod so that crashes are isolated and do not affect other services.
  • A batch processing system creates a new Pod for every job run and discards it when the job finishes, keeping the cluster clean.
  • An operations team inspects a running Pod to verify that only approved container images are executing in production.

More examples

Create and inspect a pod

Creates an imperative Pod, lists it, and describes its full status including events and container state.

Example · bash
kubectl run myapp --image=myapp:1.0
kubectl get pod myapp
kubectl describe pod myapp

Basic pod manifest

Declares a Pod with a single container, a label for selector matching, and an exposed port.

Example · yaml
apiVersion: v1
kind: Pod
metadata:
  name: myapp
  labels:
    app: myapp
spec:
  containers:
    - name: app
      image: myapp:1.0
      ports:
        - containerPort: 8080

Delete a pod and watch restart

Deletes a Deployment-managed Pod to show that Kubernetes immediately schedules a replacement to maintain the desired replica count.

Example · bash
# Pod managed by a Deployment restarts automatically
kubectl delete pod myapp-6d4f9b-xkp2t

# Replacement pod appears within seconds
kubectl get pods -w

Discussion

  • Be the first to comment on this lesson.