Skip to content

kiwix

This example shows how to save data during package create so that it can be loaded into a container running in a pod, in this case to initialize a Kiwix server to allow offline viewing of documentation and wiki pages.

By utilizing read-only OCI volumes the filesystem of the kiwix-data:local image is directly mounted into the pod.

To test this example read-only OCI volumes must be enabled in your Kubernetes cluster, and the cluster must be initialized with Zarf version 0.70.0 or greater. OCI volumes are generally available in Kubernetes 1.35.

kind: ZarfPackageConfig
metadata:
name: kiwix
description: Zarf data loading with Kiwix (https://www.kiwix.org/en/)
version: 3.5.0
components:
- name: kiwix-serve
required: true
manifests:
- name: kiwix-serve
namespace: kiwix
files:
- manifests/deployment.yaml
- manifests/service.yaml
images:
- ghcr.io/kiwix/kiwix-serve:3.5.0-2
imageArchives:
- path: kiwix-data.tar
images:
- kiwix-data:local
actions:
onCreate:
before:
# Download a .zim file of a DevOps Stack Exchange snapshot so that it can placed in the image we're building
- cmd: curl
https://zarf-remote.s3.us-east-2.amazonaws.com/testdata/devops.stackexchange.com_en_all_2023-05.zim
-o zim-data/devops.stackexchange.com_en_all_2023-05.zim
# Below are some more examples of *.zim files of available content:
# https://library.kiwix.org/?lang=eng
# NOTE: If `zarf package create`ing regularly you should mirror content to a web host you control to be a friendly neighbor
# Build a container image containing the ZIM data file
- cmd: docker build -t kiwix-data:local .
# Export the container image to a tar archive for use as an image archive
- cmd: docker save kiwix-data:local -o kiwix-data.tar