From podman-compose to Kubefiles.
Table of Contents
Overview
Kubefiles provide a powerful way to define and manage podman pods and containers in a single configuration file. One of their key advantages is their compatibility with Kubernetes.
Deploy your compose file
- Start your containers using podman-compose:
podman-compose up -d
- Verify deployment:
podman pod ls # Check pod status
podman ps # Check container status
Generate the Kubefile
Once your pod is running, generate the Kubefile:
podman kube generate <pod_name> -f kube.yaml
Replace <pod_name> with your actual pod name from podman pod ls.
The generated file includes:
- Pod specifications
- Container configurations
- Volume mappings
- Network settings
- Resource limits
Start the Kubefile
The following command will start the pod using the Kubefile, the already running containers will be replaced by the new ones defined in the Kubefile:
podman kube play --replace --service-container=true --network=podman /path/to/kube.yaml
Parameters explained:
--replace: Replaces existing containers
--service-container=true: Creates service containers
--network=podman: Uses the podman default network
Validate the deployment
podman pod ls # Check pod status
podman ps # Check container status