liveBook · Manning

Podman generate kube

As explained in Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more

podman generate kube is a Podman command that generates Kubernetes YAML manifests from running containers and pods.

podman generate kube converts the stored configuration of a local Podman container or pod into Kubernetes YAML. The manifest captures the desired runtime state, reducing the work of moving local containers into Kubernetes. section 8.1 section 8.2

The generated manifest can preserve operational details such as:

  • Pod and container names derived from the original container or pod. section 8.2
  • Container images and startup arguments, including an image reference and application command. section 8.2
  • Port mappings and securityContext capability drops. section 8.2

Generate and apply a manifest

After creating a container named myapp, run `podman generate kube myapp > myapp.yaml`. Kubernetes represents the result as a pod specification, which can then be launched with `kubectl create -f myapp.yaml`. section 8.2

$ podman generate kube myapp > myapp.yaml

Browse the command that writes a container's generated Kubernetes YAML to a file. section 8.2

How Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more covers it

How deep it goes
Explains manifest generation and fields such as images, arguments, ports, and capabilities, but does not detail the full Kubernetes schema.
Examples
Uses a myapp container, generated myapp.yaml, port 8080, an HTTP startup command, and dropped Linux capabilities.
What it assumes
Assumes familiarity with Podman containers, pods, and creation commands while demonstrating the migration workflow from those objects.
What you can do after
Operate/configure Kubernetes by generating a manifest from an existing Podman container or pod and applying it with kubectl.
How it connects
Connects Podman containers and pods with Kubernetes YAML, kubectl, and podman play kube.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more. The section links point to the parts of the book it draws on.