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.

zarf.yaml

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:
# Using zarf.internal as our registry ensures our manifest will never pull from a squatted registry url even if mutation is never run.
- zarf.internal/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 -fSL https://zarf-init-resources-dev.s3.us-east-1.amazonaws.com/devops.stackexchange.com_en_all_2026-02.zim -o zim-data/devops.stackexchange.com_en_all_2026-02.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 zarf.internal/kiwix-data:local .
# Export the container image to a tar archive for use as an image archive
- cmd: docker save zarf.internal/kiwix-data:local -o kiwix-data.tar
documentation:
readme: readme.md