CodePark/ questions / Orchestration & Kubernetes basics
START PRACTICINGPRACTICE
Backend question · Docker › Orchestration & Kubernetes basics

What is a Kubernetes Pod, and how is it different from a container?

A Pod is the smallest unit that Kubernetes schedules. It wraps one or more containers that always run together on the same node (machine).

What containers in a Pod share:

  • A network namespace. This means one IP address, so they talk to each other over localhost.
  • Volumes, if you set them up.

What runs in a Pod:

  • Most Pods run a single app container.
  • Extra containers are for tightly linked helpers, called sidecars. Examples are a log shipper or a proxy.
  • Init containers run to completion before the app starts.

Pods are disposable. Kubernetes does not repair a Pod when it dies or its node fails. Instead, a controller such as a Deployment creates a replacement. The new Pod has a new name and a new IP.

That is why you rarely create Pods directly. It is also why you never rely on a Pod's IP.

  • A Pod is the smallest unit that Kubernetes schedules.
  • A Pod holds one or more containers on the same node.
  • Containers in a Pod share one network namespace and can share volumes.
  • A Pod usually runs one app container, plus sidecars or init containers.
  • Pods are disposable, and controllers such as Deployments manage them.