Quadlet syntax: Difference between revisions
From wikinotes
(Created page with "= Overview = <blockquote> <syntaxhighlight lang="yaml"> # ~/.config/containers/systemd/${name}.${ext} # systemd unitfile generator files *.container: for a single container # podman run *.kube: from kubernetes yaml files using # podman kube play *.pod: for a single pod within kubernetes yaml files # ? is this correct? *.yml: a kubernetes yaml file # resources *.image: ensures a docker image is pulled *.network:...") |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= Documentation = | |||
<blockquote> | |||
{| class="wikitable" | |||
|- | |||
| <code>man quadlet / podman-systemd.unit</code> (incl. filetypes/opts) || https://man.archlinux.org/man/quadlet.5.en | |||
|- | |||
|} | |||
</blockquote><!-- Documentation --> | |||
= Overview = | = Overview = | ||
<blockquote> | <blockquote> | ||
Line 29: | Line 38: | ||
[Container] | [Container] | ||
Image=docker.io/library/mysql:5.6 | Image=docker.io/library/mysql:5.6 | ||
Volume=foo.volume:/var/lib/mysql | Volume=foo.volume:/var/lib/mysql | ||
Environment=TZ=UTC | |||
Network=foo.network | Network=foo.network | ||
PublishPort=127.0.0.1:1234:3306 | |||
Exec='["mysqld", "--some-param"]' | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- *.container --> | </blockquote><!-- *.container --> |
Latest revision as of 21:43, 18 May 2024
Documentation
man quadlet / podman-systemd.unit
(incl. filetypes/opts)https://man.archlinux.org/man/quadlet.5.en
Overview
# ~/.config/containers/systemd/${name}.${ext} # systemd unitfile generator files *.container: for a single container # podman run *.kube: from kubernetes yaml files using # podman kube play *.pod: for a single pod within kubernetes yaml files # ? is this correct? *.yml: a kubernetes yaml file # resources *.image: ensures a docker image is pulled *.network: create podman networks, referenced in '.container' or '.kube' files *.volume: create podman volumes, referenced in '.container' files
Standalone Containers
*.container
# ~/.config/containers/systemd/foo.container [Install] WantedBy=default.target [Container] Image=docker.io/library/mysql:5.6 Volume=foo.volume:/var/lib/mysql Environment=TZ=UTC Network=foo.network PublishPort=127.0.0.1:1234:3306 Exec='["mysqld", "--some-param"]'
Kubernetes
*.yml
A kubernetes yaml file.
# ~/.config/containers/systemd/foo.yml --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: wp-pv-claim labels: app: wordpress spec: accessModes: - ReadWriteOnce resources: requests: storage: 20Gi --- apiVersion: v1 kind: Pod metadata: name: quadlet-demo spec: containers: - name: wordpress image: docker.io/library/wordpress:4.8-apache env: - name: WORDPRESS_DB_HOST value: quadlet-demo-mysql - name: WORDPRESS_DB_PASSWORD valueFrom: secretKeyRef: name: mysql-root-password-kube key: password volumeMounts: - name: wordpress-persistent-storage mountPath: /var/www/html # ... etc ...*.pod
Abstraction of a systemd unit file for running specific kubernetes pods only.
TODO:
is this understanding correct?
*.kube
Abstraction of a systemd unit file for running an entire kubernetes project
Resources
*.network
Define a network to share between multiple containers.
# ~/.config/containers/systemd/foo.network [Network] Subnet=192.168.30.0/24 Gateway=192.168.30.1would generate
podman-network: systmd-foo # podman network create systemd-foo systemd-unit: foo-network.service*.volume
Describe a volume to share between multiple containers.
By default:
- the volume file
${filename}.volume
is created- the podman volume is called
systemd-${filename}
- the systemd service is called
${filename}-volume.service
[Volume] # all that is required if you want to share the same volume for all containers in a service*.image
Ensure a docker image is pulled.
Generates a service that can be used as a dependency.