A Podman pod is the same abstraction Kubernetes uses: a group of containers that share a network namespace (so they talk over localhost), share an IPC and PID namespace if you ask for it, and start/stop as a unit. Pods give you the “this set of processes belongs together” semantic without bringing in a control plane. They are also the easiest path to generate runnable Kubernetes YAML from a host you already trust.
How to verify
After creating a pod, the right questions to ask are:
podman pod list
podman pod inspect <pod-name> --format '{{.SharedNamespaces}}'
podman ps --pod
podman exec -it <container-in-pod> ss -tln
podman generate kube <pod-name> > pod.yaml
SharedNamespaces should include net, ipc, and uts at minimum. From any container in the pod, ss -tln should show the other containers’ ports as if they were on the same host — because in network terms, they are.
What’s happening
A pod is backed by an infra container. This is a near-zero-process container running just /catatonit -P (or the configured pause image) whose only job is to hold the namespaces open. When you add a container to the pod, Podman starts it with --net=container:<infra-id> and similar joins for IPC, UTS and optionally PID. The infra container survives application crashes, so when nginx in the pod dies and restarts, the IP address and port reservations are preserved.
This matches the Kubernetes pod model exactly. A Pod in Kubernetes is also an infra container (“pause”) plus app containers sharing its namespaces. podman generate kube translates a Podman pod into a Kubernetes Pod manifest that can be applied to any cluster — and podman play kube does the reverse, running a Kubernetes manifest as a Podman pod on a single host.
This is the migration bridge: develop and stage as Podman pods, ship to Kubernetes when scale requires it, fall back to Podman pods on edge hosts where running a full kubelet is overkill.
The procedure
- Create a pod with a published port and a name. The publish lives on the infra container — application containers inherit the network namespace, so they cannot independently publish:
podman pod create --name web-stack \
--publish 8080:80 \
--publish 8443:443 \
--share net,ipc,uts
- Add the application containers to the pod. They all share network so the database container reaches Redis at
localhost:6379:
podman run -d --pod web-stack --name redis \
docker.io/library/redis:7-alpine
podman run -d --pod web-stack --name app \
-e REDIS_URL=redis://localhost:6379 \
ghcr.io/example/api:1.2.3
podman run -d --pod web-stack --name nginx \
-v ./nginx.conf:/etc/nginx/nginx.conf:ro,Z \
docker.io/library/nginx:alpine
- Inspect the resulting topology — every container’s network namespace is the infra container’s:
podman ps --pod --format "table {{.Names}}\t{{.Status}}\t{{.Pod}}"
podman pod top web-stack
podman inspect redis --format '{{.NetworkSettings.SandboxKey}}'
podman inspect app --format '{{.NetworkSettings.SandboxKey}}'
# both SandboxKey values should be identical
- Generate a portable Kubernetes manifest from the running pod. This is the file you commit to git — it survives the host:
podman generate kube web-stack > web-stack.yaml
cat web-stack.yaml
The output is a real apiVersion: v1, kind: Pod manifest with the same container list, the same env vars, and the same volume mounts. Apply it to a Kubernetes cluster with kubectl apply -f or replay it on another Podman host:
- Replay the manifest on a fresh host:
podman pod stop web-stack && podman pod rm web-stack
podman play kube web-stack.yaml
podman pod list
- Persist the pod across reboots with a systemd-user unit. The Quadlet syntax handles the entire dependency graph for you:
# ~/.config/containers/systemd/web-stack.kube
[Unit]
Description=Web stack pod
[Kube]
Yaml=/home/operator/web-stack.yaml
[Install]
WantedBy=default.target
systemctl --user daemon-reload
systemctl --user enable --now web-stack.service
Common pitfalls
- Publishing a port from an application container after the pod is created: it has no effect because the network namespace belongs to the infra container. All ports must be declared at
podman pod createtime. - Forgetting
--share net,ipc,utsand being surprised that containers in the pod cannot resolve each other by name. They share network only when configured to. - Adding a container with a
--networkflag to a pod — Podman refuses, because the container’s network namespace is fixed by the pod. - Generating Kube YAML from a pod that uses bind mounts to host paths. The YAML references the host path verbatim — it will not apply cleanly to a Kubernetes cluster without a PersistentVolume.
- Trusting the auto-generated
podman generate kubeoutput as production-ready. It is a starting point — you still need to addresources,readinessProbe, andsecurityContextfor a real cluster deployment.
Stack Harbor uses Podman pods as the bridge between single-host workloads and full Kubernetes deployments for clients standardising their fleet — see managed operations for the per-pod systemd-user units, the Kube YAML versioning, and the replay procedure on host swap.