liveBook · Manning

Pod

As explained in Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more

A pod is a group of one or more containers that share storage and network resources and a runtime specification.

A pod groups one or more containers that work together for a common purpose. Its containers share storage, networking resources, namespaces, cgroups, and—on SELinux systems—SELinux labels. section 1.3.8 section 4.0

Podman uses pods to combine separately packaged services while preserving concrete sharing boundaries:

  • Containers in a pod share a network namespace, so a published port belongs to the pod and only one process can listen on that port. section 4.2
  • A pod volume is inherited by containers that join the pod; shared SELinux labels allow those containers to access the volume together. section 4.2
  • Containers may use different images or distributions, because they share the host kernel rather than container images. section 4.3
  • Podman manages the pod through an infra container that holds namespaces and supports the pod's shared configuration. section 4.3

Web application with a sidecar

Create a pod with a shared port and HTML volume using `podman pod create -p 8080:8080 --name mypod --volume ./html:/var/www/html:z`. Add the application with `podman create --pod mypod --name myapp quay.io/rhatdan/myimage`, then add a `ubi8` sidecar that runs `/var/www/html/time.sh`. Starting `mypod` launches the infra container, web application, and timestamp-writing sidecar; the application serves changes made through the shared volume at `http://localhost:8080`. section 4.2 section 4.3 section 4.4

$ podman pod create -p 8080:8080 --name mypod --volume ./html:/var/www/html:z
790fefe97b280e5f67c526e3a421e9c9f958cf5a98f3709373ef1afd91965955

Use the pod creation command as the starting point for a shared network and volume configuration. section 4.2

How Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more covers it

How deep it goes
Explains shared namespaces, cgroups, SELinux labels, volumes, port bindings, sidecars, and lifecycle commands, stopping short of multi-machine orchestration.
Examples
Demonstrates a web application, timestamp-writing sidecar, shared HTML volume, infra container, and localhost port 8080.
What you can do after
Apply it via Podman by creating, populating, starting, and testing a multi-container pod.
How it connects
Connects containers with namespaces, cgroups, SELinux, volumes, sidecar containers, and Kubernetes.

Also explained in

Compare how 15 books explain pod →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more. The section links point to the parts of the book it draws on.