NAME
podman-kube-play - Create containers, pods and volumes based on Kubernetes YAMLSYNOPSIS
podman kube play [options] file.yml|-|https://website.io/file.ymlDESCRIPTION
podman kube play will read in a structured file of Kubernetes YAML. It will then recreate the containers, pods or volumes described in the YAML. Containers within a pod are then started and the ID of the new Pod or the name of the new Volume is output. If the yaml file is specified as "-" then podman kube play will read the YAML file from stdin. Using the --down command line option, it is also capable of tearing down the pods created by a previous run of podman kube play. Using the --replace command line option, it will tear down the pods(if any) created by a previous run of podman kube play and recreate the pods with the Kubernetes YAML file. Ideally the input file would be one created by Podman (see podman-kube-generate(1)). This would guarantee a smooth import and expected results. The input can also be a URL that points to a YAML file such as https://podman.io/demo.yml. podman kube play will read the YAML from the URL and create pods and containers from it.- •
- 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
apiVersion: v1 kind: Pod metadata: spec: containers: - command: - top - name: container value: podman image: foobar
|- mykubefiles |- myplayfile.yaml |- foobar |- Containerfile
apiVersion: v1 kind: ConfigMap metadata: name: foo data: FOO: bar --- apiVersion: v1 kind: Pod metadata: name: foobar spec: containers: - command: - top name: container-1 image: foobar envFrom: - configMapRef: name: foo optional: false
OPTIONS
--annotation=key=value
Add an annotation to the container or pod. This option can be set multiple times.--authfile=path
Path of the authentication file. Default is ${XDG_RUNTIME_DIR}/containers/auth.json, which is set using podman login. If the authorization state is not found there, $HOME/.docker/config.json is checked, which is set using docker login.--build
Build images even if they are found in the local storage. Use --build=false to completely disable builds. (This option is not available with the remote Podman client)--cert-dir=path
Use certificates at path (*.crt, *.cert, *.key) to connect to the registry. (Default: /etc/containers/certs.d) Please refer to containers-certs.d(5) for details. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines)--configmap=path
Use Kubernetes configmap YAML at path to provide a source for environment variable values within the containers of the pod. (This option is not available with the remote Podman client)--context-dir=path
Use path as the build context directory for each image. Requires --build option be true. (This option is not available with the remote Podman client)--creds=[username[:password]]
The [username[:password]] to use to authenticate with the registry, if required. If one or both values are not supplied, a command line prompt will appear and the value can be entered. The password is entered without echo.--help, -h
Print usage statement--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 you should use the --network name:ip=<ip> syntax.--log-driver=driver
Set logging driver for all created containers.--log-opt=name=value
Logging driver specific options.(e.g. --log-opt path=/var/log/container/mycontainer.json);
(e.g. --log-opt max-size=10mb);
(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.
--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 you should use the --network name:mac=<mac> syntax.--network=mode, --net
Set the network mode for the pod.- •
- 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.
- •
- ip=IPv6: Specify a static ipv6 address for this container.
- •
- mac=MAC: Specify a static mac address for this container.
- •
- interface_name: Specify a name for the created network interface inside the container.
- allow_host_loopback=true|false: Allow slirp4netns to reach the host loopback IP (default is 10.0.2.2 or the second IP from slirp4netns cidr subnet when changed, see the cidr option below). The default is false.
- mtu=MTU: Specify the MTU to use for this network. (Default is 65520).
- cidr=CIDR: Specify ip range to use for this network. (Default is 10.0.2.0/24).
- enable_ipv6=true|false: Enable IPv6. Default is true. (Required for outbound_addr6).
- outbound_addr=INTERFACE: Specify the outbound interface slirp should bind to (ipv4 traffic only).
- outbound_addr=IPv4: Specify the outbound ipv4 address slirp should bind to.
- outbound_addr6=INTERFACE: Specify the outbound interface slirp should bind to (ipv6 traffic only).
- outbound_addr6=IPv6: Specify the outbound ipv6 address slirp should bind to.
- port_handler=rootlesskit: Use rootlesskit for port forwarding. Default.
Note: Rootlesskit changes the source IP address of incoming packets to an IP address in the container network namespace, usually 10.0.2.100. If your application requires the real source IP address, e.g. web server logs, use the slirp4netns port handler. The rootlesskit port handler is also used for rootless containers when connected to user-defined networks.
- port_handler=slirp4netns: Use the slirp4netns port forwarding, it is slower than rootlesskit but preserves the correct source IP address. This port handler cannot be used for user-defined networks.
--no-hosts
Do not create /etc/hosts for the pod. By default, Podman will manage /etc/hosts, adding the container's own IP address and any hosts from --add-host. --no-hosts disables this, and the image's /etc/hosts will be preserved unmodified.--quiet, -q
Suppress output information when pulling images--replace
Tears down the pods created by a previous run of kube play and recreates the pods. This option is used to keep the existing pods up to date based upon the Kubernetes YAML.--seccomp-profile-root=path
Directory path for seccomp profiles (default: "/var/lib/kubelet/seccomp"). (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 to false to only create it.--tls-verify
Require HTTPS and verify certificates when contacting registries (default: true). If explicitly set to true, TLS verification will be used. If set to false, TLS verification will not be used. If not specified, TLS verification will be used unless the target registry is listed as an insecure registry in containers-registries.conf(5)--userns=mode
Set the user namespace mode for the container. It defaults to the PODMAN_USERNS environment variable. An empty value ("") means user namespaces are disabled unless an explicit mapping is set with the --uidmap and --gidmap options.Key | Host User | Container User |
"" | $UID | 0 (Default User account mapped to root user in container.) |
keep-id | $UID | $UID (Map user account to same UID within container.) |
auto | $UID | nil (Host User UID is not mapped into container.) |
nomap | $UID | nil (Host User UID is not mapped into container.) |
- •
- gidmapping=_CONTAINER_GID:HOSTGID: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 will estimate a size for the user namespace.
- •
- uidmapping=_CONTAINER_UID:HOSTUID:SIZE: to force a UID mapping to be present in the user namespace.
- •
- uid=UID: override the UID inside the container that will be used to map the current rootless user to.
- •
- gid=GID: override the GID inside the container that will be used to map the current rootless user to.
EXAMPLES
Recreate the pod and containers as described in a file called demo.yml$ podman kube play demo.yml 52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6
$ cat demo.yml | podman kube play - 52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6
$ podman kube play --down demo.yml Pods stopped: 52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 Pods removed: 52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6
$ 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
$ podman kube play demo.yml --network net1:ip=10.89.1.5 --network net2:ip=10.89.10.10 52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6
$ 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 Support
This document outlines the kube yaml fields that are currently supported by the podman kube play command.Pod Fields
Field | Support |
containers | ✅ |
initContainers | ✅ |
imagePullSecrets | |
enableServiceLinks | |
os.name | |
volumes | |
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 | |
priorityClassName | |
priority | |
topologySpreadConstraints.maxSkew | |
N/A | |
topologySpreadConstraints.topologyKey | |
N/A | |
topologySpreadConstraints.whenUnsatisfiable | |
N/A | |
topologySpreadConstraints.labelSelector | |
N/A | |
topologySpreadConstraints.minDomains | |
N/A | |
restartPolicy | ✅ |
terminationGracePeriod | |
activeDeadlineSeconds | |
readinessGates.conditionType | |
hostname | ✅ |
setHostnameAsFQDN | |
subdomain | |
hostAliases.hostnames | ✅ |
hostAliases.ip | ✅ |
dnsConfig.nameservers | ✅ |
dnsConfig.options.name | ✅ |
dnsConfig.options.value | ✅ |
dnsConfig.searches | ✅ |
dnsPolicy | |
hostNetwork | ✅ |
hostPID | |
hostIPC | |
shareProcessNamespace | ✅ |
serviceAccountName | |
automountServiceAccountToken | |
securityContext.runAsUser | |
securityContext.runAsNonRoot | |
securityContext.runAsGroup | |
securityContext.supplementalGroups | |
securityContext.fsGroup | |
securityContext.fsGroupChangePolicy | |
securityContext.seccompProfile.type | |
securityContext.seccompProfile.localhostProfile | |
securityContext.seLinuxOptions.level | |
securityContext.seLinuxOptions.role | |
securityContext.seLinuxOptions.type | |
securityContext.seLinuxOptions.user | |
securityContext.sysctls.name | |
securityContext.sysctls.value | |
securityContext.windowsOptions.gmsaCredentialSpec | |
securityContext.windowsOptions.hostProcess | |
securityContext.windowsOptions.runAsUserName | |
Container Fields
Field | Support |
name | ✅ |
image | ✅ |
imagePullPolicy | ✅ |
command | ✅ |
args | ✅ |
workingDir | ✅ |
ports.containerPort | ✅ |
ports.hostIP | ✅ |
ports.hostPort | ✅ |
ports.name | ✅ |
ports.protocol | ✅ |
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 | |
✅ | |
envFrom.configMapRef.name | ✅ |
envFrom.configMapRef.optional | ✅ |
envFrom.prefix | |
envFrom.secretRef.name | ✅ |
envFrom.secretRef.optional | ✅ |
volumeMounts.mountPath | ✅ |
volumeMounts.name | ✅ |
volumeMounts.mountPropagation | |
volumeMounts.readOnly | ✅ |
volumeMounts.subPath | |
volumeMounts.subPathExpr | |
volumeDevices.devicePath | |
volumeDevices.name | |
resources.limits | ✅ |
resources.requests | ✅ |
lifecycle.postStart | |
lifecycle.preStop | |
terminationMessagePath | |
terminationMessagePolicy | |
livenessProbe | ✅ |
readinessProbe | |
startupProbe | |
securityContext.runAsUser | ✅ |
securityContext.runAsNonRoot | |
securityContext.runAsGroup | ✅ |
securityContext.readOnlyRootFilesystem | |
✅ | |
securityContext.procMount | |
securityContext.privileged | ✅ |
securityContext.allowPrivilegeEscalation | |
✅ | |
securityContext.capabilities.add | |
✅ | |
securityContext.capabilities.drop | |
✅ | |
securityContext.seccompProfile.type | |
securityContext.seccompProfile.localhostProfile | |
securityContext.seLinuxOptions.level | |
✅ | |
securityContext.seLinuxOptions.role | |
✅ | |
securityContext.seLinuxOptions.type | |
✅ | |
securityContext.seLinuxOptions.user | |
✅ | |
securityContext.windowsOptions.gmsaCredentialSpec | |
securityContext.windowsOptions.hostProcess | |
securityContext.windowsOptions.runAsUserName | |
stdin | |
stdinOnce | |
tty |
PersistentVolumeClaim Fields
Field | Support |
volumeName | |
storageClassName | ✅ |
volumeMode | |
accessModes | ✅ |
selector | |
resources.limits | |
resources.requests | ✅ |
ConfigMap Fields
Field | Support |
binaryData | ✅ |
data | ✅ |
immutable |
Deployment Fields
Field | Support |
replicas | ✅ |
selector | ✅ |
template | ✅ |
minReadySeconds | |
strategy.type | |
strategy.rollingUpdate.maxSurge | |
strategy.rollingUpdate.maxUnavailable | |
revisionHistoryLimit | |
progressDeadlineSeconds | |
paused |