Pods is now the minimum deployment unit for containers in Kubernetes. Similar support is provided by Podman. Although podman-compose works almost identically. But this is a good concept in terms of convenience, security and later migration to k8s.

The specific architecture is as follows.

pod

To use the pod function of podman, make sure that catatonit is installed in advance.

Common commands

Create a pod

1
2
sudo podman pod create -n test-pod
850580d6a80befc5efd015213f5887c750577988bbd4bb753e0a5f4a1037e1f7

List all pods

1
2
3
∴ sudo podman pod list
POD ID        NAME        STATUS      CREATED             INFRA ID      # OF CONTAINERS
850580d6a80b  test-pod    Created     About a minute ago  5b40275320b0  1

Add a container to a pod

Adds a container of top to the pod named test-pod created earlier.

1
sudo podman run -dt --pod test-pod docker.io/library/alpine:latest top

In addition, pod also supports commands such as ps as follows.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$ sudo podman pod

NAME:
   podman pod - Manage container pods.


Pods are a group of one or more containers sharing the same network, pid and ipc namespaces.

USAGE:
   podman pod command [command options] [arguments...]


COMMANDS:
    create        Create a new empty pod
    exists        Check if a pod exists in local storage
    inspect       displays a pod configuration
    kill          Send the specified signal or SIGKILL to containers in pod
    pause         Pause one or more pods
    ps, ls, list  List pods
    restart       Restart one or more pods
    rm            Remove one or more pods
    start         Start one or more pods
    stats         Display percentage of CPU, memory, network I/O, block I/O and PIDs for containers in one or more pods
    stop          Stop one or more pods
    top           Display the running processes of containers in a pod
    unpause       Unpause one or more pods

OPTIONS:
   --help, -h  show help

Summary

With the above command, you can easily start and stop the containers that need to be put together in a pod to control the network, etc. Before deploy.yaml is not supported, we may expect podman-compose to improve the function as soon as possible. Otherwise, the current situation can only be used in some limited container cases.

But in the latest version of 4.0+, you can use this pod with systemd. This makes it possible to use more scenarios.