This guide explains how to deploy a self-hosted Zotero WebDAV server on a lightweight Kubernetes (K3s) cluster.
Run the following command to install K3s:
curl -sfL https://get.k3s.io | sh -
Configure access to the cluster:
mkdir -p ~/.kube
sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
sudo chown $(id -u):$(id -g) ~/.kube/config
chmod 600 ~/.kube/config
To speed up local development and avoid pushing images to external registries, set up a local registry mirror:
sudo tee /etc/rancher/k3s/registries.yaml > /dev/null <<EOF
mirrors:
"REGISTRY":
endpoint:
- "http://REGISTRY"
EOF
Replace
REGISTRY
with your registry address (e.g.localhost:5000
).
Restart K3s to apply the config:
sudo systemctl restart k3s
Build the Docker image for the WebDAV server:
docker build -t zotero-webdav .
(Option) If you're using a local registry:
docker tag zotero-webdav REGISTRY/zotero-webdav
docker push REGISTRY/zotero-webdav
Replace
REGISTRY
with your registry address.
Create a namespace:
kubectl create namespace zotero-webdav
Edit manifest.yaml.template
:
spec:
containers:
- name: zotero-webdav
+ image: zotero-webdav
- image: REGISTRY/zotero-webdav
ports:
- containerPort: 8080
Replace
REGISTRY
with your registry address.
Deploy:
USER=zotero PASSWORD=password envsubst < manifest.yaml.template | kubectl apply -f -
Replace
USER
andPASSWORD
with your username and password.
Check deployment status:
kubectl get all -n zotero-webdav
If you rebuild or retag your Docker image, restart the deployment like this:
kubectl rollout restart deployment -n zotero-webdav -l app.kubernetes.io/component=webdav
ingress.yaml
Example:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: zotero-webdav
namespace: zotero-webdav
labels:
app.kubernetes.io/name: zotero-webdav
app.kubernetes.io/component: ingress
spec:
ingressClassName: traefik
rules:
- http:
paths:
- path: /zotero-webdav/USER/zotero
pathType: Prefix
backend:
service:
name: zotero-webdav-USER-svc
port:
number: 8080
Replace
USER
with username.
Apply the Ingress:
kubectl apply -f ingress.yaml