podman-kube-play(1)

πŸ’… podman-kube-play(1) πŸ’…

okay so bestie, welcome to podman-kube-play(1) from the General Commands Manual section β€” this is the one that takes your Kubernetes YAML and makes real containers, pods and volumes out of it ✨


πŸŽ€ NAME πŸŽ€

podman-kube-play β€” create containers, pods and volumes based on Kubernetes YAML 🫢


🌈 SYNOPSIS 🌈

podman kube play [options] file.yml|-|https://website.io/file.yml

πŸ¦‹ DESCRIPTION πŸ¦‹

So podman kube play reads in a structured file of Kubernetes YAML and recreates the containers, pods, or volumes that are described in it. Containers inside a pod get started, and then you get back the ID of the new Pod or the name of the new Volume πŸ’–

If the YAML file is passed as -, then podman kube play reads that YAML straight from stdin. And the input can also be a URL pointing at a YAML file β€” think something like https://podman.io/demo.yml β€” and Podman will read the YAML from that URL and create pods and containers from it. no cap 🌸

With the --down command line option, it's also able to tear down the pods created by a previous run of podman kube play. bye bestie πŸ‘‹

With the --replace command line option, it tears down the pods (if any) created by a previous run of podman kube play and recreates the pods using the Kubernetes YAML file. glow-up era πŸ’…

Ideally your input file is created by the Podman command itself (see podman-kube-generate(1)) β€” that guarantees a smooth import and the expected results. iykyk ✨

Currently, the supported Kubernetes kinds are:

  • Pod
  • Deployment
  • PersistentVolumeClaim
  • ConfigMap
  • Secret
  • DaemonSet
  • Job

πŸ‘‘ Kubernetes Pods or Deployments πŸ‘‘

Only five volume types are supported by kube play: the hostPath, emptyDir, configMap, persistentVolumeClaim, and image volume types.

  • When you use the hostPath volume type, only the default (empty), DirectoryOrCreate, Directory, FileOrCreate, File, Socket, CharDevice and BlockDevice subtypes are supported. Podman interprets the value of hostPath path as a file path when it contains at least one forward slash β€” otherwise Podman treats that value as the name of a named volume πŸ—‚οΈ
  • When you use a persistentVolumeClaim, the value for claimName is the name for the Podman named volume.
  • When you use an emptyDir volume, Podman creates an anonymous volume that is attached to the containers running inside the pod, and it's deleted once the pod is removed.
  • When you use a configMap volume, Podman creates an anonymous volume that is attached to the containers running inside the pod, and it's deleted once the pod is removed.
  • When you use an image volume, Podman creates a read-only image volume with an empty subpath (the whole image is mounted). The image must already exist locally. It's supported in rootful mode only πŸ‘‘
Note: the default restart policy for containers is always. You can change that default by setting the restartPolicy field in the spec.
Note: when playing a kube YAML with init containers, the init container is created with init type value once. To change that default type, use the io.podman.annotations.init.container.type annotation to set the type to always.
Note: hostPath volume types created by kube play get an SELinux shared label (z), and bind mounts are not relabeled (use chcon -t container_file_t -R <directory>). πŸ™ˆ
Note: to set the userns of a pod, use the io.podman.annotations.userns annotation in the pod/deployment definition. For example, io.podman.annotations.userns=keep-id tells Podman to create a user namespace where the current rootless user's UID:GID are mapped to the same values in the container. This can be overridden with the --userns flag.
Note: use the io.podman.annotations.volumes-from annotation to bind mount volumes of one container to another. You can mount volumes from multiple source containers to a target container. The source containers that belong to the same pod must be defined before the source container in the kube YAML. The annotation format is io.podman.annotations.volumes-from/targetContainer: "sourceContainer1:mountOpts1;sourceContainer2:mountOpts2".
Note: if the :latest tag is used, Podman attempts to pull the image from a registry. If the image was built locally with Podman or Buildah, it has localhost as the domain β€” in that case, Podman uses the image from the local store even if it has the :latest tag 🎯
Note: the command podman play kube is an alias of podman kube play, and performs the same function.
Note: the command podman kube down can be used to stop and remove pods or containers based on the same Kubernetes YAML that podman kube play used to create them.
Note: to customize the name of the infra container created during podman kube play, use the io.podman.annotations.infra.name annotation in the pod definition. This annotation is automatically set when generating a kube yaml from a pod that was created with the --infra-name flag set.
Note: use the io.podman.annotations.pids-limit/$ctrname annotation to configure the pod's pids limit.
Note: use the io.podman.annotations.cpuset/$ctrname annotation to restrict a container's execution to a specific set of CPU cores. This is equivalent to the --cpuset-cpus=number option in podman-run(1).
Note: use the io.podman.annotations.memory-nodes/$ctrname annotation to restrict a container's memory allocations to a specific set of memory nodes on NUMA systems. This is equivalent to the --cpuset-mems=nodes option in podman-run(1).

πŸ“ Kubernetes PersistentVolumeClaims πŸ“

A Kubernetes PersistentVolumeClaim represents a Podman named volume. Only the PersistentVolumeClaim name is required by Podman to create a volume. Kubernetes annotations can be used to make use of the available options for Podman volumes πŸ’œ

  • volume.podman.io/driver
  • volume.podman.io/device
  • volume.podman.io/type
  • volume.podman.io/uid
  • volume.podman.io/gid
  • volume.podman.io/mount-options
  • volume.podman.io/import-source
  • volume.podman.io/image

Use volume.podman.io/import-source to import the contents of the tarball (.tar, .tar.gz, .tgz, .bzip, .tar.xz, .txz, .tar.zst) specified in the annotation's value into the created Podman volume πŸ“¦

Kube play is capable of building images on the fly given the correct directory layout and Containerfiles. This option is not available for remote clients, including Mac and Windows (excluding WSL2) machines, yet. Consider the following excerpt from a YAML file:

apiVersion: v1
kind: Pod
metadata:
...
spec:
  containers:
  - name: container
    image: foobar
...

If there's a directory named foobar in the current working directory with a file named Containerfile or Dockerfile inside it, Podman kube play builds that image and names it foobar. An example directory structure for this example looks like:

|- mykubefiles
    |- myplayfile.yaml
    |- foobar
         |- Containerfile

The build considers foobar to be the context directory for the build. If there's an image in local storage called foobar, the image is not built unless the --build flag is used. Use --build=false to completely disable builds πŸ™…β€β™€οΈ

Kube play supports CDI (Container Device Interface) device selectors to share host devices (e.g. GPUs) with containers. The configuration format follows Kubernetes extended resource management:

apiVersion: v1
kind: Pod
spec:
  containers:
  - name: container
    resources:
      limits:
        nvidia.com/gpu=all: 1

To enable sharing host devices β€” analogous to using the --device flag β€” Podman kube supports a custom CDI selector: podman.io/device=<host device path> πŸ”₯

🧚 Kubernetes ConfigMap 🧚

A Kubernetes ConfigMap can be referred to as a source of environment variables or volumes in Pods or Deployments. ConfigMaps aren't a standalone object in Podman; instead, when a container uses a ConfigMap, Podman creates the environment variables or volumes as needed ✨

For example, the following YAML document defines a ConfigMap and then uses it in a Pod:

apiVersion: v1
kind: ConfigMap
metadata:
  name: foo
data:
    FOO: bar
---
apiVersion: v1
kind: Pod
metadata:
  name: foobar
spec:
  containers:
  - name: container-1
    image: foobar
    envFrom:
    - configMapRef:
        name: foo
        optional: false

and as a result the environment variable FOO is set to bar for container container-1 πŸŽ‰

🌸 Kubernetes Secret 🌸

A Kubernetes Secret represents a Podman named secret. The Kubernetes Secret is saved as a whole and may be referred to as a source of environment variables or volumes in Pods or Deployments πŸ”

For example, the following YAML document defines a Secret and then uses it in a Pod:

kind: Secret
apiVersion: v1
metadata:
  name: foo
data:
  foo: YmFy # base64 for bar
---
apiVersion: v1
kind: Pod
metadata:
  name: foobar
spec:
  containers:
  - name: container-1
    image: foobar
    env:
    - name: FOO
      valueFrom:
        secretKeyRef:
          name: foo
          key: foo

and as a result the environment variable FOO is set to bar for container container-1 πŸ’–

πŸ’€ Automounting Volumes (deprecated) πŸ’€

Note: the automounting annotation is deprecated. Kubernetes has native support for image volumes, and that should be used rather than this podman-specific annotation. periodt.

An image can be automatically mounted into a container if the annotation io.podman.annotations.kube.image.automount/$ctrname is given. The following rules apply:

  • The image must already exist locally.
  • The image must have at least 1 volume directive.
  • The path given by the volume directive is mounted from the image into the container. For example, an image with a volume at /test/test_dir has /test/test_dir in the image mounted to /test/test_dir in the container.
  • Multiple images can be specified. If multiple images have a volume at a specific path, the last image specified trumps πŸ‘‘
  • The images are always mounted read-only.
  • Images to mount are defined in the annotation "io.podman.annotations.kube.image.automount/$ctrname" as a semicolon-separated list. They're mounted into a single container in the pod, not the whole pod. The annotation can be specified for additional containers if additional mounts are required.

✨ OPTIONS ✨

🌟 --annotation=key=value 🌟

  • --annotation=key=value β€” add an annotation to the container or pod. This option can be set multiple times πŸ”
Note: for podman kube play, the --annotation flag adds Podman-specific annotations to the containers and pods created by Podman β€” not to the Kubernetes YAML itself. These annotations can be used to configure Podman-specific features like user namespaces (io.podman.annotations.userns), volumes-from (io.podman.annotations.volumes-from), and other container behaviors πŸ’…
  • --authfile=path β€” where your auth file lives, bestie πŸ’–. Default is ${XDG_RUNTIME_DIR}/containers/auth.json on Linux, and $HOME/.config/containers/auth.json on Windows/macOS. That file? Made by podman login. And if the authorization state isn't chillin' there, it checks $HOME/.docker/config.json, which is set using docker login.

Note: you can also override the default path of the authentication file by setting the REGISTRY_AUTH_FILE environment variable β€” just do export REGISTRY_AUTH_FILE=path.

  • --build β€” builds images even if they're already found in local storage, no cap ✨. Use --build=false to completely disable builds. (heads up: this option is not available with the remote Podman client)

Note: you can also override the default isolation type by setting the BUILDAH_ISOLATION environment variable, like export BUILDAH_ISOLATION=oci. See podman-build.1.md for more info. πŸŽ€

  • --cert-dir=path β€” use certificates at path (*.crt, *.cert, *.key) to connect to the registry. (Default: /etc/containers/certs.d) For details, see containers-certs.d(5). (this one's not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines πŸ™ˆ)
  • --configmap=path β€” use the Kubernetes ConfigMap YAML at path to provide environment variable values within the containers of the pod πŸ¦‹. (not available with the remote Podman client)

Note: the --configmap option can be used multiple times, or a comma-separated list of paths can be used to pass multiple Kubernetes ConfigMap YAMLs. The YAML file may be in a multi-doc YAML format β€” but it must contain only ConfigMaps, okay? πŸ‘‘

  • --context-dir=path β€” use path as the build context directory for each image. Requires the --build option to be true. (not available with the remote Podman client)
  • --creds=[username[:password]] β€” the [username[:password]] to use to authenticate with the registry, if it's required πŸ”₯. If one or both values aren't supplied, a command line prompt shows up and you can type the value in. The password is entered without echo (very discreet, we love that πŸ’…).

Note that the specified credentials are only used to authenticate against target registries. They are not used for mirrors or when the registry gets rewritten (see containers-registries.conf(5)); to authenticate against those, consider using a containers-auth.json(5) file. iykyk 🌸

  • --force β€” tear down the volumes linked to the PersistentVolumeClaims as part of --down. Fr fr, it's the cleanup crew 🧹
  • --help, -h β€” print usage statement. Classic, iconic, always there for you 🫢
  • --ip=IP address β€” assign a static ip address to the pod. This option can be specified several times when kube play creates more than one pod. Note: when joining multiple networks, use the --network name:ip=<ip> syntax 🌈
  • --log-driver=driver β€” set logging driver for all created containers. Simple as that ✨
  • --log-opt=name=value β€” logging driver specific options. Set custom logging configuration πŸ’œ. The following *name*s are supported:
    • path: specify a path to the log file (e.g. --log-opt path=/var/log/container/mycontainer.json);
    • max-size: specify a max size of the log file (e.g. --log-opt max-size=10mb);
    • tag: specify a custom log tag for the container (e.g. --log-opt tag="{{.ImageName}}"). It supports the same keys as podman inspect --format. This option is currently supported only by the journald log driver.
    • label: specify a custom log label for the container (e.g. --log-opt label="CONTAINER_IMAGE={{.ImageName}}"). It supports the same keys as podman inspect --format. This option can be repeated multiple times. This option is currently supported only by the journald log driver.
  • --mac-address=MAC address β€” assign a static mac address to the pod. This option can be specified several times when kube play creates more than one pod. Note: when joining multiple networks, use the --network name:mac=<mac> syntax πŸŽ€
  • --network=mode, --net β€” set the network mode for the pod 🌐. Valid mode values are:
    • bridge[:OPTIONS,...]: create a network stack on the default bridge. This is the default for rootful containers. It is possible to specify these additional options:
      • alias=name: add network-scoped alias for the container.
      • ip=IPv4: specify a static IPv4 address for this container.
      • ip6=IPv6: specify a static IPv6 address for this container.
      • mac=MAC: specify a static MAC address for this container.
      • interface_name=name: specify a name for the created network interface inside the container.
      • host_interface_name=name: specify a name for the created network interface outside the container.

Any other options will be passed through to netavark without validation. This can be useful to pass arguments to netavark plugins.

For rootless bridge networks, port forwarding uses rootlessport by default. Setting rootless_port_forwarder="pasta" in the [network] section of containers.conf(5) switches to pasta's kernel-level forwarding (via pesto), which preserves the original client source IP address inside the container. This option is experimental and its behavior is subject to change πŸ‘€.

For example, to set a static IPv4 address and a static mac address, use --network bridge:ip=10.88.0.10,mac=44:33:22:11:00:99.

  • <network name or ID>[:OPTIONS,...]: connect to a user-defined network β€” this is the network name or ID from a network created by podman network create. It is possible to specify the same options described under the bridge mode above. Use the --network option multiple times to specify additional networks. For backwards compatibility it is also possible to specify comma-separated networks on the first --network argument, however this prevents you from using the options described under the bridge section above πŸ¦‹.
  • none: create a network namespace for the container but do not configure network interfaces for it, thus the container has no network connectivity. Ghost mode, literally πŸ‘»
  • container:id: reuse another container's network stack.
  • host: use the host's network namespace for the container instead of creating an isolated namespace.
Warning: this gives the container full access to abstract Unix domain sockets and to TCP/UDP sockets bound to localhost. Since these mechanisms are often used to prevent access to sensitive system services, isolating them from access by external entities, use of this option may be considered a security vulnerability. 😭 Not the vibe, be careful!
  • ns:path: path to a network namespace to join.
  • private: create a new namespace for the container. This uses the bridge mode for rootful containers and pasta for rootless ones.
  • pasta[:OPTIONS,...]: use pasta(1) to create a user-mode networking stack. This is the default for rootless containers and only supported in rootless mode. By default, IPv4 and IPv6 addresses and routes, as well as the pod interface name, are copied from the host. Port forwarding preserves the original source IP address. Options described in pasta(1) can be specified as comma-separated arguments.

In terms of pasta(1) options, --config-net is given by default, in order to configure networking when the container is started, and --no-map-gw is also assumed by default, to avoid direct access from container to host using the gateway address. The latter can be overridden by passing --map-gw in the pasta-specific options (despite not being an actual pasta(1) option) πŸ’….

For better integration with DNS handling, --dns-forward 169.254.1.1 is passed by default, and this address is added to resolv.conf(5) as first resolver. It is possible to pass --dns-forward explicitly in case a different IP address should be used.

To make the host.containers.internal /etc/hosts entry work and allow connections to the host, --map-guest-addr 169.254.1.2 is passed by default. Again, it can be set explicitly to choose a different IP address ✨.

Also, -t none and -u none are passed if, respectively, no TCP or UDP port forwarding from host to container is configured (via Podman's --publish or by passing the pasta -t/-u options directly), to disable automatic port forwarding based on bound ports. Similarly, -T none and -U none are given to disable the same functionality from container to host.

All options can also be set in containers.conf(5); see the pasta_options key under the network section in that file.

Some examples πŸ‘‘

  • pasta:--map-gw: allow the container to directly reach the host using the gateway address.
  • pasta:--mtu,1500: specify a 1500 bytes MTU for the tap interface in the container.
  • pasta:--ipv4-only,-a,10.0.2.0,-n,24,-g,10.0.2.2,--dns-forward,10.0.2.3,-m,1500,--no-ndp,--no-dhcpv6,--no-dhcp: disable IPv6, assign 10.0.2.0/24 to the tap0 interface in the container, with gateway 10.0.2.3, enable DNS forwarder reachable at 10.0.2.3, set MTU to 1500 bytes, disable NDP, DHCPv6 and DHCP support.
  • pasta:-I,tap0,--ipv4-only,-a,10.0.2.0,-n,24,-g,10.0.2.2,--dns-forward,10.0.2.3,--no-ndp,--no-dhcpv6,--no-dhcp: same as above, but leave the MTU to 65520 bytes.
  • pasta:-t,auto,-u,auto,-T,auto,-U,auto: enable automatic port forwarding based on observed bound ports from both host and container sides.
  • pasta:-T,5201: enable forwarding of TCP port 5201 from container to host, using the loopback interface instead of the tap interface for improved performance.

When no network option is specified and host network mode is not configured in the YAML file, a new network stack is created and pods are attached to it making possible pod to pod communication 🫢.

  • --no-hostname β€” do not create the /etc/hostname file in the containers.

By default, Podman manages the /etc/hostname file, adding the container's own hostname. When the --no-hostname option is set, the image's /etc/hostname will be preserved unmodified if it exists 🌸

  • --no-hosts β€” do not modify the /etc/hosts file in the pod.

Podman assumes control over the pod's /etc/hosts file by default and adds entries for the container's name (see --name option) and hostname (see --hostname option), the internal host.containers.internal and host.docker.internal hosts, as well as any hostname added using the --add-host option. Refer to the --add-host option for details. Passing --no-hosts disables this, so that the image's /etc/hosts file is kept unmodified. The same can be achieved globally by setting no_hosts=true in containers.conf.

This option conflicts with host added in the Kubernetes YAML. πŸ’€
  • --no-pod-prefix β€” do not prefix container name with pod name. Let them have their own identity, main character energy πŸ‘‘
  • --publish=[[ip:][hostPort]:]containerPort[/protocol] β€” define or override a port definition in the YAML file πŸ”₯

Okay so the port lists in your YAML file and on the command line literally get merged together πŸ’…. Matchmaking is done using the containerPort field β€” and if containerPort shows up in both the YAML file and the option, the option wins, periodt.


  • --publish-all β€” set this to true and every single port gets exposed to the host, even the ones that were only chillin' as containerPort in the K8 YAML. As for which port actually gets exposed? Priority order bestie: --publish > hostPort > containerPort. πŸ‘‘ If it's false (and that's the default), only ports defined via hostPort or --publish get published on the host. No sneaky extras.
  • --quiet, -q β€” shhh 🀫 suppress the output info while pulling images. Silent mode, very demure.
  • --replace β€” tears down the pods created by a previous run of kube play and recreates them. Use this when you wanna keep your existing pods up to date based on the Kubernetes YAML. Glow-up for your pods ✨.
  • *--seccomp-profile-root=path* β€” the directory path for seccomp profiles (default: "/var/lib/kubelet/seccomp"). πŸ™ˆ Heads up: this option is NOT available with the remote Podman client, including Mac and Windows (excluding WSL2) machines.
  • --start β€” start the pod after creating it. Set it to false if you just wanna create it and let it sit there looking cute. πŸŽ€
  • --tls-verify β€” require HTTPS and verify certificates when contacting registries (default: true).
    • explicitly set to true β†’ TLS verification is used βœ…
    • set to false β†’ TLS verification is not used πŸ™ˆ
    • not specified at all β†’ TLS verification is used unless the target registry is listed as an insecure registry in containers-registries.conf(5).

πŸ’œ --userns=mode

Sets the user namespace mode for the container. This one's a whole journey, bestie, stay with me 🫢.

If --userns isn't set, the default value is determined like this:

  • If --pod is set, --userns is ignored and the user namespace of the pod is used.
  • If the environment variable PODMAN_USERNS is set, its value is used.
  • If userns is specified in containers.conf, that value is used.
  • Otherwise, --userns=host is assumed.

--userns="" (i.e., an empty string) is an alias for --userns=host, iykyk.

⚠️ This option is incompatible with --gidmap, --uidmap, --subuidname and --subgidname. They can't sit with us πŸ’€.

Rootless user --userns=Key mappings β€” the receipts:

  • auto β€” host user $UID, container user nil (host user UID is not mapped into container.)
  • host β€” host user $UID, container user 0 (default user account mapped to root user in container.)
  • keep-id β€” host user $UID, container user $UID (map the user account to the same UID within the container.)
  • keep-id:uid=200,gid=210 β€” host user $UID, container user 200:210 (map the user account to the specified UID, GID value within the container.)
  • nomap β€” host user $UID, container user nil (host user UID is not mapped into container.)

Valid mode values are:

auto[:OPTIONS,...] β€” automatically create a unique user namespace 🌈.

  • rootful mode: the --userns=auto flag requires that the user name containers be specified in the /etc/subuid and /etc/subgid files, with an unused range of subordinate user IDs that Podman containers are allowed to allocate. Example: containers:2147483647:2147483648.
  • rootless mode: the users range from the /etc/subuid and /etc/subgid files will be used. Note that running a single container without using --userns=auto will use the entire range of UIDs and not allow further subdividing. See subuid(5).

Podman allocates unique ranges of UIDs and GIDs from the containers subordinate user IDs. The size of the ranges is based on the number of UIDs required in the image πŸ–ΌοΈ. The number of UIDs and GIDs can be overridden with the size option.

The option --userns=keep-id uses all the subuids and subgids of the user. The option --userns=nomap uses all the subuids and subgids of the user except the user's own ID. Using --userns=auto when starting new containers does not work as long as any containers exist that were started with --userns=nomap or --userns=keep-id without limiting the user namespace size. 😭 Yeah. That one's a vibe check that fails.

Valid auto options:

  • gidmapping=CONTAINER_GID:HOST_GID:SIZE β€” to force a GID mapping to be present in the user namespace.
  • size=SIZE β€” to specify an explicit size for the automatic user namespace. e.g. --userns=auto:size=8192. If size is not specified, auto estimates a size for the user namespace.
  • uidmapping=CONTAINER_UID:HOST_UID:SIZE β€” to force a UID mapping to be present in the user namespace.

The host UID and GID in gidmapping and uidmapping can optionally be prefixed with the @ symbol. In that case, podman will look up the intermediate ID corresponding to host ID and it will map the found intermediate ID to the container id. For details see --uidmap πŸ”.

*container:id* β€” join the user namespace of the specified container. Slay, shared vibes only.

host or "" (empty string) β€” run in the user namespace of the caller. The processes running in the container have the same privileges on the host as any other process launched by the calling user. πŸ‘‘

keep-id β€” creates a user namespace where the current user's UID:GID are mapped to the same values in the container. For containers created by root, the current mapping is created into a new user namespace.

In addition, the init process within the container will run under the current user's UID. This behavior overrides the image's USER instruction unless you explicitly set --user.

Valid keep-id options:

  • uid=UID β€” override the UID inside the container that is used to map the current user to.
  • gid=GID β€” override the GID inside the container that is used to map the current user to.
  • size=SIZE β€” override the size of the configured user namespace. It's useful to not saturate all the available IDs. Not supported when running as root.

nomap β€” creates a user namespace where the current rootless user's UID:GID are not mapped into the container. πŸ™ˆ This option is not allowed for containers created by the root user.

ns:namespace β€” run the pod in the given existing user namespace.


  • --wait, -w β€” run pods and containers in the foreground. Default is false.

At any time you can run podman pod ps in another shell to view a list of the running pods and containers. πŸ“‹

When attached in the tty mode, you can kill the pods and containers by pressing Ctrl+C or by receiving any other interrupt signals.

All pods, containers, and volumes created with podman kube play are removed upon exit. πŸ’€ Gone. Poof. So keep that in mind before you rage-quit.


🌸 EXAMPLES 🌸

Recreate the pod and containers described in the specified host YAML file:

$ podman kube play demo.yml
52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6

Recreate the pod and containers specified in a YAML file sent to stdin:

$ cat demo.yml | podman kube play -
52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6

Tear down the pod and containers as described in the specified YAML file:

$ podman kube play --down demo.yml
Pods stopped:
52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6
Pods removed:
52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6

Provide multiple configmap files as sources for environment variables within the specified pods and containers πŸŽ€:

$ podman kube play demo.yml --configmap configmap-foo.yml,configmap-bar.yml
52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6
$ podman kube play demo.yml --configmap configmap-foo.yml --configmap configmap-bar.yml
52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6

Create a pod connected to two networks with a static ip on each πŸ”₯:

$ podman kube play demo.yml --network net1:ip=10.89.1.5 --network net2:ip=10.89.10.10
52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6
Please take into account that networks must be created first using podman-network-create(1). No network, no vibes.

Create and teardown from a URL pointing to a YAML file:

$ podman kube play https://podman.io/demo.yml
52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6
$ podman kube play --down https://podman.io/demo.yml
Pods stopped:
52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6
Pods removed:
52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6
⚠️ podman kube play --down does not work with a URL if the YAML file the URL points to has been changed or altered. Iconic but rude. 😭

πŸ‘‘ Podman Kube Play Support πŸ‘‘

This document outlines the kube yaml fields that are currently supported by the podman kube play command 🫢.

πŸ“ Note: N/A means that the option cannot be supported in a single-node Podman environment.

🌸 Pod Fields 🌸

okay bestie, this is the part where we do a vibe check on every single pod field you might drop into your YAML 🌈 β€” some of them Podman is obsessed with (that's the βœ…), some it just... doesn't do (that's no 😭), and some are straight-up N/A because they're scheduling things that genuinely do not apply here, no cap. Here's the whole list, nothing skipped, in the exact order the original gives it πŸ’…

  • containers β€” βœ… slay, fully supported
  • initContainers β€” βœ… yes bestie
  • imagePullSecrets β€” no
  • enableServiceLinks β€” no
  • os.name β€” no
  • volumes β€” βœ… supported
  • nodeSelector β€” N/A
  • nodeName β€” N/A
  • affinity.nodeAffinity β€” N/A
  • affinity.podAffinity β€” N/A
  • affinity.podAntiAffinity β€” N/A
  • tolerations.key β€” N/A
  • tolerations.operator β€” N/A
  • tolerations.effect β€” N/A
  • tolerations.tolerationSeconds β€” N/A
  • schedulerName β€” N/A
  • runtimeClassName β€” no
  • priorityClassName β€” no
  • priority β€” no
  • topologySpreadConstraints.maxSkew β€” N/A
  • topologySpreadConstraints.topologyKey β€” N/A
  • topologySpreadConstraints.whenUnsatisfiable β€” N/A
  • topologySpreadConstraints.labelSelector β€” N/A
  • topologySpreadConstraints.minDomains β€” N/A
  • restartPolicy β€” βœ… yes queen
  • terminationGracePeriodSeconds β€” βœ… supported
  • activeDeadlineSeconds β€” no
  • readinessGates.conditionType β€” no
  • hostname β€” βœ… supported
  • setHostnameAsFQDN β€” no
  • subdomain β€” no
  • hostAliases.hostnames β€” βœ… supported
  • hostAliases.ip β€” βœ… supported
  • dnsConfig.nameservers β€” βœ… supported
  • dnsConfig.options.name β€” βœ… supported
  • dnsConfig.options.value β€” βœ… supported
  • dnsConfig.searches β€” βœ… supported
  • dnsPolicy β€” no
  • hostNetwork β€” βœ… supported
  • hostPID β€” βœ… supported
  • hostIPC β€” βœ… supported
  • shareProcessNamespace β€” βœ… supported
🫢 quick legend so nobody's confused: βœ… = Podman's got you, no = nope, not supported, N/A = doesn't apply here at all. That's literally it, fr fr πŸ’–

…and we're right back into it, bestie πŸ’… here's the rest of the field list β€” βœ… means yes it's supported, plain no means nope, not supported:

  • serviceAccountName β€” no πŸ™ˆ not supported
  • automountServiceAccountToken β€” no πŸ™ˆ not supported
  • securityContext.runAsUser β€” βœ… supported, slay
  • securityContext.runAsNonRoot β€” no πŸ™ˆ not supported
  • securityContext.runAsGroup β€” βœ… supported, iconic
  • securityContext.supplementalGroups β€” βœ… supported
  • securityContext.fsGroup β€” no πŸ™ˆ not supported
  • securityContext.fsGroupChangePolicy β€” no πŸ™ˆ not supported
  • securityContext.seccompProfile.type β€” no πŸ™ˆ not supported
  • securityContext.seccompProfile.localhostProfile β€” no πŸ™ˆ not supported
  • securityContext.seLinuxOptions.level β€” βœ… supported
  • securityContext.seLinuxOptions.role β€” βœ… supported
  • securityContext.seLinuxOptions.type β€” βœ… supported
  • securityContext.seLinuxOptions.user β€” βœ… supported
  • securityContext.sysctls.name β€” βœ… supported
  • securityContext.sysctls.value β€” βœ… supported
  • securityContext.windowsOptions.gmsaCredentialSpec β€” no πŸ™ˆ not supported
  • securityContext.windowsOptions.hostProcess β€” no πŸ™ˆ not supported
  • securityContext.windowsOptions.runAsUserName β€” no πŸ™ˆ not supported

like, the pattern is pretty clear at this point, right? the SELinux + sysctl + basic runAs bits ate, and the Windows options… did not πŸ’€

πŸ§ƒ Container Fields β€” aka "what can I actually put in a container spec, bestie?" πŸ™ˆ

okay so this is the part everyone DMs me about. every field you might want to cram into a container in your Pod YAML, and whether podman kube play is gonna vibe with it or leave you on read. βœ… means slay, it works. no means... not so much 😭.

Quick legend, iykyk: the βœ… is support, no is "nope, not implemented, don't come for me."


✨ The basics ✨

  • name β€” βœ… yes bestie, your container gets a name
  • image β€” βœ… the whole point honestly
  • imagePullPolicy β€” βœ… respected, we love a pull strategy
  • command β€” βœ… override that entrypoint
  • args β€” βœ… and the args too
  • workingDir β€” βœ… where the container starts chillin'

πŸ”Œ ports.* β€” let the internet in 🌈

  • ports.containerPort β€” βœ…
  • ports.hostIP β€” βœ…
  • ports.hostPort β€” βœ…
  • ports.name β€” βœ…
  • ports.protocol β€” βœ…

all five port fields, fully supported, no crumbs πŸ’…


πŸ“ env.* β€” environment variables, the whole buffet πŸŽ€

  • env.name β€” βœ…
  • env.value β€” βœ…
  • env.valueFrom.configMapKeyRef.key β€” βœ…
  • env.valueFrom.configMapKeyRef.name β€” βœ…
  • env.valueFrom.configMapKeyRef.optional β€” βœ…
  • env.valueFrom.fieldRef β€” βœ…
  • env.valueFrom.resourceFieldRef β€” βœ…
  • env.valueFrom.secretKeyRef.key β€” βœ…
  • env.valueFrom.secretKeyRef.name β€” βœ…
  • env.valueFrom.secretKeyRef.optional β€” βœ…

configmaps, secrets, field refs, resource field refs β€” all of it, iconic behavior πŸ‘‘


🧚 envFrom.* β€” bulk env, with one tiny catch 😭

  • envFrom.configMapRef.name β€” βœ…
  • envFrom.configMapRef.optional β€” βœ…
  • envFrom.prefix β€” no πŸ’€
  • envFrom.secretRef.name β€” βœ…
  • envFrom.secretRef.optional β€” βœ…
bestie, envFrom.prefix is not supported. so no cute little prefix on your bulk vars, adjust your plans accordingly πŸ™ˆ

πŸ¦‹ volumeMounts.* β€” where the files live πŸŽ€

  • volumeMounts.mountPath β€” βœ…
  • volumeMounts.name β€” βœ…
  • volumeMounts.mountPropagation β€” no
  • volumeMounts.readOnly β€” βœ…
  • volumeMounts.subPath β€” βœ…
  • volumeMounts.subPathExpr β€” no

so mountPropagation and subPathExpr are both a no β€” literally not supported, don't fight it πŸ’…


πŸ’œ volumeDevices.* β€” bestie... no 🌸

  • volumeDevices.devicePath β€” no
  • volumeDevices.name β€” no

raw block devices? not today, not supported, we move 😭


πŸ”₯ resources.* β€” limits and requests, both ate πŸ”₯

  • resources.limits β€” βœ…
  • resources.requests β€” βœ…

🌈 lifecycle.* β€” a mixed bag, ngl

  • lifecycle.postStart β€” no
  • lifecycle.preStop β€” no
  • lifecycle.stopSignal β€” βœ…

so the lifecycle hooks are a no-no, but stopSignal is supported and honestly that's the one that matters most of the time 🫢


πŸ’€ terminationMessage* β€” nope, both of them

  • terminationMessagePath β€” no
  • terminationMessagePolicy β€” no

⭐ livenessProbe β€” yes queen πŸ‘‘

  • livenessProbe β€” βœ…

she's alive, she's supported, she's checking on you πŸ’–


…and finishing off the container fields, bestie πŸ‘‘

  • readinessProbe β€” no πŸ™ˆ not supported
  • startupProbe β€” no πŸ™ˆ not supported
  • securityContext.runAsUser β€” βœ… yup, supported
  • securityContext.runAsNonRoot β€” no πŸ™ˆ not supported
  • securityContext.runAsGroup β€” βœ… supported
  • securityContext.readOnlyRootFilesystem β€” βœ… supported
  • securityContext.procMount β€” βœ… supported
  • securityContext.privileged β€” βœ… supported
  • securityContext.allowPrivilegeEscalation β€” βœ… supported
  • securityContext.capabilities.add β€” βœ… supported
  • securityContext.capabilities.drop β€” βœ… supported
  • securityContext.seccompProfile.type β€” no πŸ™ˆ not supported
  • securityContext.seccompProfile.localhostProfile β€” no πŸ™ˆ not supported
  • securityContext.seLinuxOptions.level β€” βœ… supported
  • securityContext.seLinuxOptions.role β€” βœ… supported
  • securityContext.seLinuxOptions.type β€” βœ… supported
  • securityContext.seLinuxOptions.user β€” βœ… supported
  • securityContext.windowsOptions.gmsaCredentialSpec β€” no πŸ™ˆ not supported
  • securityContext.windowsOptions.hostProcess β€” no πŸ™ˆ not supported
  • securityContext.windowsOptions.runAsUserName β€” no πŸ™ˆ not supported
  • stdin β€” no πŸ™ˆ not supported
  • stdinOnce β€” no πŸ™ˆ not supported
  • tty β€” no πŸ™ˆ not supported

That's the whole container list, done and dusted ✨ (and yeah, tty being a no is a little tragic, we know 😭)


πŸ—‚οΈ PersistentVolumeClaim Fields

Now the storage girlies πŸ’Ύ β€” here's what a PersistentVolumeClaim can and can't do:

  • volumeName β€” no πŸ™ˆ not supported
  • storageClassName β€” βœ… supported
  • volumeMode β€” no πŸ™ˆ not supported
  • accessModes β€” βœ… supported
  • selector β€” no πŸ™ˆ not supported
  • resources.limits β€” no πŸ™ˆ not supported
  • resources.requests β€” βœ… supported

So like β€” requests? iconic, supported. limits? not invited to the party πŸ’€. Don't @ me, that's just what the table says.


πŸ“œ ConfigMap Fields

And the ConfigMap girlies, last but never least πŸŽ€:

  • binaryData β€” βœ… supported
  • data β€” βœ… supported
  • immutable β€” no πŸ™ˆ not supported

data and binaryData? both eating, no crumbs πŸ“. immutable? bestie that's a no from us.

πŸ’… Deployment Fields

okay so a Deployment is like... a whole squad, right? here's what actually gets picked up when you hand it to podman kube play:

  • replicas β€” βœ… yes bestie, it's supported... BUT ✨plot twist✨ the actual replica count is ignored and set to 1. so don't come for me when you asked for 12 and got 1, that's just the vibe 🫢
  • selector β€” βœ…
  • template β€” βœ…
  • minReadySeconds β€” no πŸ™ˆ
  • strategy.type β€” no
  • strategy.rollingUpdate.maxSurge β€” no
  • strategy.rollingUpdate.maxUnavailable β€” no
  • revisionHistoryLimit β€” no
  • progressDeadlineSeconds β€” no
  • paused β€” no

like half the deployment spec is just... not invited to the party πŸ’€ but the important bits (selector, template) showed up and ate πŸ”₯


πŸŽ€ DaemonSet Fields

DaemonSet sounds intense and honestly? iconic name. here's the support list:

  • selector β€” βœ…
  • template β€” βœ…
  • minReadySeconds β€” no
  • strategy.type β€” no
  • strategy.rollingUpdate.maxSurge β€” no
  • strategy.rollingUpdate.maxUnavailable β€” no
  • revisionHistoryLimit β€” no

same story as Deployment: the core two (selector + template) said yes, everything else left you on read 😭


πŸ’œ Job Fields

Job fields, aka the "one and done" energy of k8s. peep this:

  • activeDeadlineSeconds β€” no
  • selector β€” no (it's automatically set by k8s, so like... not your business, the cluster handles it πŸ‘‘)
  • template β€” βœ…
  • backoffLimit β€” no
  • completionMode β€” no
  • completions β€” no (set to 1 with kube generate)
  • manualSelector β€” no
  • parallelism β€” no (set to 1 with kube generate)
  • podFailurePolicy β€” no
  • suspend β€” no
  • ttlSecondsAfterFinished β€” no

not me noticing that template is literally the only βœ… here 😭 everything else is a hard no, with completions and parallelism both getting quietly set to 1 by kube generate. lowkey a solo mission fr fr.


🌈 SEE ALSO 🌈

go read these next, bestie, they're the whole friend group:


and that's the whole page!! πŸŽ‰ you made it to the end, I'm so proud of you πŸ₯ΉπŸ’–

that was podman-kube-play(1) from the Podman manual, version-and-date era as shipped with the docs ✨ go forth and play your kubes, you absolute main character πŸŒΈπŸ¦‹πŸ’…

πŸ“¦ where this page comes from