Quadlet

From wikinotes
Revision as of 18:47, 5 May 2024 by Will (talk | contribs)

Quadlet is a tool for generating systemd services from podman containers.
You can also describe a project as a podman-compose project, and generate systemd services for it as well.

The goal for the project is to be concise and change tolerant with sane defaults.

Documentation

man quadlet / podman-systemd.unit (incl. filetypes/opts) https://man.archlinux.org/man/quadlet.5.en
official tutorial https://www.redhat.com/sysadmin/multi-container-application-podman-quadlet
src https://github.com/containers/podman/tree/main/pkg/systemd/quadlet

Tutorials

https://mo8it.com/blog/quadlet/ intro

Locations

~/.config/containers/systemd/*.{kube,container,volume,network,yml} build systemd services from these
/usr/libexec/podman/quadlet quadlet executable (not on path)

Usage

Overview

While quadlet is technically an executable, it's designed to work with systemd commands directly.

After adding your files to ~/.config/containers/systemd/*.{kube,container,volume,network,yml},
you can run daemon-reload and your generated systemd services will be made available.

Here's the TL;DR from the official tutorial:

mkdir -p $HOME/.config/containers/systemd/
cp envoy-proxy-configmap.yml \
   quadlet-demo.kube \
   quadlet-demo-mysql.container \
   quadlet-demo-mysql.volume \
   quadlet-demo.network \
   quadlet-demo.yml \
   $HOME/.config/containers/systemd/
systemctl --user daemon-reload
systemctl --user start quadlet-demo.service

You can debug the generated files using

/usr/libexec/podman/quadlet --dryrun

Secrets

It looks like these are primarily managed using kubernetes own utils from kubectl create secret ${secret}.

TODO:

more research is needed here.

Syntax

Overview

# container descriptions
*.container: manages containers using 'podman run'
*.kube:      manage containers defined in kubernetes yaml files using 'podman kube play'

# resources
*.network:   create podman networks, referenced in '.container' or '.kube' files
*.volume:    create podman volumes, referenced in '.container' files