Deployment, Service, and storage
Terminal
strategy: Recreate stops the old pod before starting the new one, so an upgrade never has two pods competing for the volume. On first start, KiwiFS initializes an empty volume as a new knowledge base.
The image runs as the non-root user kiwi. If the volume isn’t writable by that user, set securityContext.fsGroup on the pod to the user’s group ID, which docker run --rm --entrypoint id ameliaanhlam/kiwifs prints.
Configuration and secrets
Keepconfig.toml in a ConfigMap and secrets in a Secret. config.toml can read secrets from environment variables with ${VAR}, which you then fill from the Secret.
subPath, so the rest of /data/.kiwi stays on the writable volume. Because the config file already exists, KiwiFS skips its first-start initialization, so run kiwifs init in an init container. It only creates files that are missing.
kiwifs-deployment.yaml (excerpt)
config.toml at startup. A subPath mount doesn’t pick up ConfigMap edits, so restart the Deployment after changing it with kubectl rollout restart deployment/kiwifs.
KiwiFS only reads a few environment variables directly:
KIWI_BACKUP_REMOTE, KIWI_BACKUP_INTERVAL, KIWI_BACKUP_REBASE_BEFORE_PUSH, and KIWI_PUBLIC_URL. Everything else, including API keys, must be referenced from config.toml.Health probes
Health endpoints don’t require authentication, even when auth is on.
NFS for other pods
KiwiFS includes a userspace NFSv3 server, so other pods can mount the knowledge base as a native volume. It doesn’t need privileged mode or kernel NFS support.1
Enable NFS on the KiwiFS pod
--nfs-allow to the CIDRs your nodes mount from, since the kubelet performs the mount from the node.2
Expose the NFS port
kiwifs-nfs-service.yaml
3
Mount it from another pod
server.3334 and 3335.
Multiple spaces
Serve several knowledge bases from one pod by mounting a volume per space and registering each with--space name=path.
/api/kiwi/<name>/.... See Multi-space.
Ingress
kiwifs-ingress.yaml
proxy-body-size for file uploads, which the import endpoint accepts up to 256 MB, and proxy-read-timeout for document exports, which can take up to five minutes. The web UI and API expect to be served from the root path.
Related
Docker
Image contents, environment variables, and Compose.
Backup sync
Push history to a git remote on a schedule.