Services

Resources

Company

Kubernetes pod

A pod is the smallest unit you can deploy in Kubernetes. It wraps one or more containers that always run together on the same node. The containers in a pod share one IP address and network namespace, so they reach each other on localhost, and they can mount the same volumes.

How it works

Most pods run one application container. Some add a sidecar, such as a log shipper or proxy, that needs the same network or files. You rarely create pods directly: a Deployment, StatefulSet or Job creates them from a template and replaces them when they fail.

For example, kubectl get pods might show checkout-7d9f 2/2 Running with IP 10.0.1.17: two containers, both ready. The app listens on port 8080 and the sidecar reads from it at localhost:8080.

Why it matters in production

Pods are disposable. When one is rescheduled it gets a new name and a new IP, so clients should reach pods through a Service, not by IP. Each pod also takes an IP from the cluster's pod range, so large clusters can run out of addresses before they run out of CPU.

See also

On the One2N blog

References

  1. Pods (Kubernetes documentation)

Comic about a Kubernetes pod: Kubernetes runs each app across many computers in a pod; a pod can hold a few containers that work together, like an app and a log helper, sharing one address, 10.0.1.17; when a pod crashes a new one replaces it at 10.0.1.42, and anyone using the old address is lost; Kai uses a Service name instead, which always finds the live pod.