|
|
Line 54: |
Line 54: |
| |} | | |} |
| </blockquote><!-- Notes --> | | </blockquote><!-- Notes --> |
|
| |
| = Syntax =
| |
| <blockquote>
| |
| == 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: create podman networks, referenced in '.container' or '.kube' files
| |
| *.volume: create podman volumes, referenced in '.container' files
| |
| </syntaxhighlight>
| |
| </blockquote><!-- Overview -->
| |
|
| |
| == Standalone Containers ==
| |
| <blockquote>
| |
| === *.container ===
| |
| <blockquote>
| |
| <syntaxhighlight lang="dosini">
| |
| # ~/.config/containers/systemd/foo.container
| |
|
| |
| [Install]
| |
| WantedBy=default.target
| |
|
| |
| [Container]
| |
| Image=docker.io/library/mysql:5.6
| |
| ContainerName=foo
| |
| Volume=foo.volume:/var/lib/mysql
| |
| Network=foo.network
| |
| </syntaxhighlight>
| |
| </blockquote><!-- *.container -->
| |
| </blockquote><!-- Standalone Containers -->
| |
|
| |
| == Kubernetes ==
| |
| <blockquote>
| |
| === *.yml ===
| |
| <blockquote>
| |
| A kubernetes yaml file.
| |
|
| |
| {{ WARN |
| |
| this is the official example, haven't had to use this yet
| |
| }}
| |
| <syntaxhighlight lang="yaml">
| |
| # ~/.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 ...
| |
| </syntaxhighlight>
| |
| </blockquote><!-- *.yml -->
| |
|
| |
| === *.pod ===
| |
| <blockquote>
| |
| Abstraction of a systemd unit file for running specific kubernetes pods only.
| |
|
| |
| {{ TODO |
| |
| is this understanding correct?
| |
| }}
| |
| </blockquote><!-- *.pod -->
| |
|
| |
| === *.kube ===
| |
| <blockquote>
| |
| Abstraction of a systemd unit file for running an entire kubernetes project
| |
| </blockquote><!-- *.kube -->
| |
| </blockquote><!-- Kubernetes -->
| |
|
| |
| == Resources ==
| |
| <blockquote>
| |
| === *.network ===
| |
| <blockquote>
| |
| Define a network to share between multiple containers.
| |
|
| |
| <syntaxhighlight lang="dosini">
| |
| # ~/.config/containers/systemd/foo.network
| |
|
| |
| [Network]
| |
| Subnet=192.168.30.0/24
| |
| Gateway=192.168.30.1
| |
| </syntaxhighlight>
| |
|
| |
| would generate
| |
| <syntaxhighlight lang="yaml">
| |
| podman-network: systmd-foo # podman network create systemd-foo
| |
| systemd-unit: foo-network.service
| |
| </syntaxhighlight>
| |
| </blockquote><!-- .network -->
| |
|
| |
| === *.volume ===
| |
| <blockquote>
| |
| Describe a volume to share between multiple containers.
| |
|
| |
| By default:
| |
| * the volume file <code>${filename}.volume</code> is created
| |
| * the podman volume is called <code>systemd-${filename}</code>
| |
| * the systemd service is called <code>${filename}-volume.service</code>
| |
|
| |
| <syntaxhighlight lang="dosini">
| |
| [Volume]
| |
| # all that is required if you want to share the same volume for all containers in a service
| |
| </syntaxhighlight>
| |
| </blockquote><!-- *.volume -->
| |
|
| |
| === *.image ===
| |
| <blockquote>
| |
| Ensure a docker image is pulled.<br>
| |
| Generates a service that can be used as a dependency.
| |
| </blockquote><!-- *.image -->
| |
| </blockquote><!-- Resources -->
| |
| </blockquote><!-- Syntax -->
| |
|
| |
|
| = Examples = | | = Examples = |