DEV Community

Cover image for What are Kubernetes pods ?
Adi Polak
Adi Polak

Posted on

What are Kubernetes pods ?

A Pod is a group of one or more containers, such as Docker.
It is important to understand that although Kubernetes is defined as a container orchestrator. It doesn't run containers directly.
Instead, it wraps one or more containers into a higher-level structure AKA pod.

The group shares storage and network, and a specification for how to run the containers. A Pod’s contents are always co-located, co-scheduled and run in a shared context.

Containers within a Pod share an IP address and port space.
They can find each other via localhost. They can also communicate with each other using standard inter-process communications(IPC) like POSIX shared memory.

Containers in different Pods have distinct IP addresses and can not communicate by IPC without special configuration. Hence, they will use Pod IP addresses instead.

Applications within a Pod also have access to shared volumes, which defined as part of a Pod and are made available to be mounted into each application’s filesystem.

In terms of Docker, a Pod is modeled as a group of Docker containers with shared namespaces and shared filesystem volumes.

Pods are not durable and have a lifecycle:

  1. Pods are created
  2. Pods assigned a unique ID (UID)
  3. Pods are scheduled to nodes ( until restart of deletion )

Phase status is part of the lifecycle:

FYI

  • If a Node dies, after a timeout period, the Pods scheduled to that node are scheduled for deletion.
  • Pod with UID can be replaced by an identical Pod, with the same name if desired, but with a new UID.

... that's a wrap!

That was Kubernetes pods in under 3 min! which is part of Kubernetes Bitesize series.

Resources:
Kubernetes.io
Step by step tutorial

Top comments (0)