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)

Four-panel comic about Kubernetes pods: an app container and a log-shipper sidecar need shared files and localhost; a pod groups them with one IP, one network namespace and a shared volume on one node; kubectl shows checkout-7d9f 2/2 Running at 10.0.1.17 with the sidecar reading localhost:8080; a recreated pod gets a new name and IP, so a Service gives clients a stable address.