.nh .TH podman-play-kube(1) .SH NAME .PP podman-play-kube - Create containers, pods or volumes based on Kubernetes YAML .SH SYNOPSIS .PP \fBpodman play kube\fP [\fIoptions\fP] \fIfile.yml|-\fP .SH DESCRIPTION .PP \fBpodman play kube\fP 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 \fB\fCpodman play kube\fR will read the YAML file from stdin. Using the \fB\fC--down\fR command line option, it is also capable of tearing down the pods created by a previous run of \fB\fCpodman play kube\fR\&. Ideally the input file would be one created by Podman (see podman-generate-kube(1)). This would guarantee a smooth import and expected results. .PP Currently, the supported Kubernetes kinds are: - Pod - Deployment - PersistentVolumeClaim - ConfigMap .PP \fB\fCKubernetes Pods or Deployments\fR .PP Only two volume types are supported by play kube, the \fIhostPath\fP and \fIpersistentVolumeClaim\fP volume types. For the \fIhostPath\fP volume type, only the \fIdefault (empty)\fP, \fIDirectoryOrCreate\fP, \fIDirectory\fP, \fIFileOrCreate\fP, \fIFile\fP, and \fISocket\fP subtypes are supported. The \fICharDevice\fP and \fIBlockDevice\fP subtypes are not supported. Podman interprets the value of \fIhostPath\fP \fIpath\fP as a file path when it contains at least one forward slash, otherwise Podman treats the value as the name of a named volume. When using a \fIpersistentVolumeClaim\fP, the value for \fIclaimName\fP is the name for the Podman named volume. .PP Note: When playing a kube YAML with init containers, the init container will be created with init type value \fB\fCalways\fR\&. .PP Note: \fIhostPath\fP volume types created by play kube will be given an SELinux private label (Z) .PP Note: If the \fB\fC:latest\fR tag is used, Podman will attempt to pull the image from a registry. If the image was built locally with Podman or Buildah, it will have \fB\fClocalhost\fR as the domain, in that case, Podman will use the image from the local store even if it has the \fB\fC:latest\fR tag. .PP \fB\fCKubernetes PersistentVolumeClaims\fR .PP 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. .RS .IP \(bu 2 volume.podman.io/driver .IP \(bu 2 volume.podman.io/device .IP \(bu 2 volume.podman.io/type .IP \(bu 2 volume.podman.io/uid .IP \(bu 2 volume.podman.io/gid .IP \(bu 2 volume.podman.io/mount-options .RE .PP Play kube is capable of building images on the fly given the correct directory layout and Containerfiles. This option is not available for remote clients yet. Consider the following excerpt from a YAML file: .PP .RS .nf apiVersion: v1 kind: Pod metadata: ... spec: containers: - command: - top - name: container value: podman image: foobar ... .fi .RE .PP If there is a directory named \fB\fCfoobar\fR in the current working directory with a file named \fB\fCContainerfile\fR or \fB\fCDockerfile\fR, Podman play kube will build that image and name it \fB\fCfoobar\fR\&. An example directory structure for this example would look like: .PP .RS .nf |- mykubefiles |- myplayfile.yaml |- foobar |- Containerfile .fi .RE .PP The build will consider \fB\fCfoobar\fR to be the context directory for the build. If there is an image in local storage called \fB\fCfoobar\fR, the image will not be built unless the \fB\fC--build\fR flag is used. .PP \fB\fCKubernetes ConfigMap\fR .PP Kubernetes ConfigMap can be referred as a source of environment variables in Pods or Deployments. .PP For example ConfigMap defined in following YAML: .PP .RS .nf apiVersion: v1 kind: ConfigMap metadata: name: foo data: FOO: bar .fi .RE .PP can be referred in a Pod in following way: .PP .RS .nf apiVersion: v1 kind: Pod metadata: ... spec: containers: - command: - top name: container-1 image: foobar envFrom: - configMapRef: name: foo optional: false .fi .RE .PP and as a result environment variable \fB\fCFOO\fR will be set to \fB\fCbar\fR for container \fB\fCcontainer-1\fR\&. .SH OPTIONS .SS \fB--authfile\fP=\fIpath\fP .PP Path of the authentication file. Default is ${XDG_RUNTIME_DIR}/containers/auth.json, which is set using \fB\fCpodman login\fR\&. If the authorization state is not found there, $HOME/.docker/config.json is checked, which is set using \fB\fCdocker login\fR\&. .PP Note: You can also override the default path of the authentication file by setting the REGISTRY_AUTH_FILE environment variable. \fB\fCexport REGISTRY_AUTH_FILE=path\fR .SS \fB--build\fP .PP Build images even if they are found in the local storage. .SS \fB--cert-dir\fP=\fIpath\fP .PP Use certificates at \fIpath\fP (*\&.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) .SS \fB--configmap\fP=\fIpath\fP .PP Use Kubernetes configmap YAML at path to provide a source for environment variable values within the containers of the pod. .PP Note: The \fI--configmap\fP option can be used multiple times or a comma-separated list of paths can be used to pass multiple Kubernetes configmap YAMLs. .SS \fB--creds\fP .PP 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. .SS \fB--down\fP .PP Tears down the pods that were created by a previous run of \fB\fCplay kube\fR\&. The pods are stopped and then removed. Any volumes created are left intact. .SS \fB--ip\fP=\fIIP address\fP .PP Assign a static ip address to the pod. This option can be specified several times when play kube creates more than one pod. .SS \fB--log-driver\fP=driver .PP Set logging driver for all created containers. .SS \fB--mac-address\fP=\fIMAC address\fP .PP Assign a static mac address to the pod. This option can be specified several times when play kube creates more than one pod. .SS \fB--network\fP=\fImode\fP, \fB--net\fP .PP Change the network mode of the pod. The host and bridge network mode should be configured in the yaml file. Valid \fImode\fP values are: .RS .IP \(bu 2 \fBnone\fP: Create a network namespace for the container but do not configure network interfaces for it, thus the container has no network connectivity. .IP \(bu 2 \fBcontainer:\fP\fIid\fP: Reuse another container's network stack. .IP \(bu 2 \fBnetwork\fP: Connect to a user-defined network, multiple networks should be comma-separated. .IP \(bu 2 \fBns:\fP\fIpath\fP: Path to a network namespace to join. .IP \(bu 2 \fBprivate\fP: Create a new namespace for the container. This will use the \fBbridge\fP mode for rootfull containers and \fBslirp4netns\fP for rootless ones. .IP \(bu 2 \fBslirp4netns[:OPTIONS,...]\fP: use \fBslirp4netns\fP(1) to create a user network stack. This is the default for rootless containers. It is possible to specify these additional options: .RS .IP \(bu 2 \fBallow_host_loopback=true|false\fP: Allow the slirp4netns to reach the host loopback IP (\fB\fC10.0.2.2\fR, which is added to \fB\fC/etc/hosts\fR as \fB\fChost.containers.internal\fR for your convenience). Default is false. .IP \(bu 2 \fBmtu=MTU\fP: Specify the MTU to use for this network. (Default is \fB\fC65520\fR). .IP \(bu 2 \fBcidr=CIDR\fP: Specify ip range to use for this network. (Default is \fB\fC10.0.2.0/24\fR). .IP \(bu 2 \fBenable_ipv6=true|false\fP: Enable IPv6. Default is false. (Required for \fB\fCoutbound_addr6\fR). .IP \(bu 2 \fBoutbound_addr=INTERFACE\fP: Specify the outbound interface slirp should bind to (ipv4 traffic only). .IP \(bu 2 \fBoutbound_addr=IPv4\fP: Specify the outbound ipv4 address slirp should bind to. .IP \(bu 2 \fBoutbound_addr6=INTERFACE\fP: Specify the outbound interface slirp should bind to (ipv6 traffic only). .IP \(bu 2 \fBoutbound_addr6=IPv6\fP: Specify the outbound ipv6 address slirp should bind to. .IP \(bu 2 \fBport_handler=rootlesskit\fP: Use rootlesskit for port forwarding. Default. Note: Rootlesskit changes the source IP address of incoming packets to a IP address in the container network namespace, usually \fB\fC10.0.2.100\fR\&. 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. .IP \(bu 2 \fBport_handler=slirp4netns\fP: 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. .RE .RE .SS \fB--quiet\fP, \fB-q\fP .PP Suppress output information when pulling images .SS \fB--seccomp-profile-root\fP=\fIpath\fP .PP Directory path for seccomp profiles (default: "/var/lib/kubelet/seccomp"). (This option is not available with the remote Podman client) .SS \fB--start\fP=\fItrue|false\fP .PP Start the pod after creating it, set to false to only create it. .SS \fB--tls-verify\fP=\fItrue|false\fP .PP Require HTTPS and verify certificates when contacting registries (default: true). If explicitly set to true, then TLS verification will be used. If set to false, then 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 registries.conf. .SS \fB--help\fP, \fB-h\fP .PP Print usage statement .SH EXAMPLES .PP Recreate the pod and containers as described in a file called \fB\fCdemo.yml\fR .PP .RS .nf $ podman play kube demo.yml 52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 .fi .RE .PP Recreate the pod and containers as described in a file \fB\fCdemo.yml\fR sent to stdin .PP .RS .nf $ cat demo.yml | podman play kube - 52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 .fi .RE .PP Teardown the pod and containers as described in a file \fB\fCdemo.yml\fR .PP .RS .nf $ podman play kube --down demo.yml Pods stopped: 52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 Pods removed: 52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 .fi .RE .PP Provide \fB\fCconfigmap-foo.yml\fR and \fB\fCconfigmap-bar.yml\fR as sources for environment variables within the containers. .PP .RS .nf $ podman play kube demo.yml --configmap configmap-foo.yml,configmap-bar.yml 52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 $ podman play kube demo.yml --configmap configmap-foo.yml --configmap configmap-bar.yml 52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 .fi .RE .PP CNI network(s) can be specified as comma-separated list using \fB\fC--network\fR .PP .RS .nf $ podman play kube demo.yml --network cni1,cni2 52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 .fi .RE .PP Please take into account that CNI networks must be created first using podman-network-create(1). .SH SEE ALSO .PP podman(1), podman-container(1), podman-pod(1), podman-generate-kube(1), podman-play(1), podman-network-create(1), containers-certs.d(5) .SH HISTORY .PP December 2018, Originally compiled by Brent Baude (bbaude at redhat dot com)