Last updated

Kubernetes

An example deployment: a small set of plain manifests plus the notes you need to run them. Copy and adapt them; do not apply them blindly to production.

The manifests live in the core repository under deploy/kubernetes/.

Windshift runs as a single replica

Run exactly one Windshift pod. This is not a tuning suggestion; the application is not safe to scale horizontally today:

  • Schema migrations run at startup with no distributed lock. Every replica applies pending migrations as it boots. Several replicas starting at once against an out-of-date database can race DDL.
  • Live updates are per-process. The server-sent-events hub is in memory, so a client only receives item updates from the pod it is connected to. A second replica would serve stale live views.
  • Background schedulers run per process without leader election. Notification digests, outbound email, recurrence, custom-field cleanup, runner lease reaping, SCM sync, magic-link cleanup and issue sync all tick in every process. Two replicas would send duplicate mail and run duplicate syncs.

The manifests therefore set replicas: 1 and strategy: Recreate. Horizontal scaling would need application work — a migration lock, an SSE backplane, and leases for the schedulers — not deployment changes.

Files

File Purpose
00-namespace.yaml Namespace. Remove if you deploy into an existing one.
10-pvc.yaml ReadWriteOnce PVC for /data.
20-deployment.yaml The Windshift pod, probes, env and security context.
30-service.yaml ClusterIP Service on port 80, targeting 8080.
40-ingress.yaml Example Ingress with SSE-safe timeouts. Delete if unused.
secret.yaml.example Shape of the Secret to create; not applied by kubectl.

Prerequisites

  • A Kubernetes cluster (1.27+) with a default StorageClass
  • kubectl
  • For production: a PostgreSQL 14+ server

Quick start with SQLite

The default manifest uses SQLite on the /data PVC, which is enough to try Windshift out.

# 1. Create the namespace and the session secret.
kubectl apply -f deploy/kubernetes/00-namespace.yaml
kubectl -n windshift create secret generic windshift-secrets \
  --from-literal=SSO_SECRET="$(openssl rand -hex 32)"

# 2. Edit BASE_URL and (optionally) the Ingress host, then apply the rest.
#    The Secret file is intentionally not matched by `kubectl apply -f`.
kubectl apply -f deploy/kubernetes/10-pvc.yaml
kubectl apply -f deploy/kubernetes/20-deployment.yaml
kubectl apply -f deploy/kubernetes/30-service.yaml
# kubectl apply -f deploy/kubernetes/40-ingress.yaml

# 3. Watch it come up.
kubectl -n windshift rollout status deploy/windshift

# 4. Reach it without an Ingress.
kubectl -n windshift port-forward svc/windshift 8080:80
# open http://127.0.0.1:8080 and complete the setup wizard

SSO_SECRET signs sessions and encrypts stored credentials. Keep it stable across upgrades: changing it invalidates sessions and stored secrets. If you delete and recreate the Secret, restore the previous value.

Configuration

Settings are plain environment variables on the Deployment. The complete reference is Environment variables; the ones that matter most on Kubernetes:

Variable Notes
BASE_URL Public scheme and host. Must match how users reach Windshift, or cookies, links and WebAuthn break.
USE_PROXY true behind an Ingress or reverse proxy.
PROXY_TRUST_MODE strict trusts only loopback and ADDITIONAL_PROXIES; legacy (the pre-0.9.8 default) also trusts every private address. The manifest sets strict. See Proxy trust.
ADDITIONAL_PROXIES Comma-separated literal proxy addresses allowed to supply forwarding headers. No CIDR ranges.
SSO_SECRET Required. From the windshift-secrets Secret.
WINDSHIFT_CONTEXT_PATH Set when serving under a subpath, for example /windshift. Probes follow it.
ATTACHMENT_PATH, PLUGIN_DIR, AI_PROMPTS_DIR Default under /data.
DB_TYPE, DB_PATH sqlite and /data/windshift.db by default.
WINDSHIFT_METRICS_TOKEN Optional bearer token protecting /metrics.
WINDSHIFT_MEMORY_LIMIT_MB Process budget. Keep at or below the container memory limit.

Probes

The Deployment uses the built-in endpoints:

  • liveness: GET /healthz
  • readiness and startup: GET /readyz

Both are public and honour WINDSHIFT_CONTEXT_PATH. Readiness returns HTTP 200 while attachment storage is unreachable and marks the response degraded; only the database fails the probe. See Health checks.

PostgreSQL

Comment out DB_TYPE=sqlite and DB_PATH, uncomment the POSTGRES_* block in 20-deployment.yaml, and add the password to the Secret:

kubectl -n windshift create secret generic windshift-secrets \
  --from-literal=SSO_SECRET="$(openssl rand -hex 32)" \
  --from-literal=POSTGRES_PASSWORD="..."

Keep the declared connection budget consistent with the database's max_connections. With a single Windshift replica POSTGRES_REPLICA_COUNT stays at 1; Windshift validates the budget at startup and reports it in Admin → Diagnostics.

Ingress and TLS

40-ingress.yaml is an nginx example. Three things to get right:

  1. Streaming timeouts. Item detail views hold a server-sent-events connection open, and nginx's default 60s read timeout drops it. The example sets proxy-read-timeout and proxy-send-timeout to 3600s. Translate that to your controller's annotations.
  2. BASE_URL. Set it to the public URL and keep USE_PROXY=true.
  3. Proxy trust. The manifest sets PROXY_TRUST_MODE=strict. An nginx Ingress reaches Windshift from a dynamic controller pod address, which cannot be listed in ADDITIONAL_PROXIES (literal addresses only). Either add a loopback sidecar as described in Proxy trust, or list a stable ingress address — for example a hostNetwork controller's node IP. Verify on Admin → Diagnostics → Proxy trust: the status must be protected and Unlisted proxies empty.

Backups

Back up the /data volume and, when using PostgreSQL, the database. Backup and restore covers the Compose case in detail; the same files and database are involved here. A PVC snapshot plus pg_dump is enough for most installations. With an S3 attachment backend, remember that attachment blobs live in the bucket and need its own versioning or replication.

Upgrades

  1. Change image: in 20-deployment.yaml to the new release tag.
  2. Apply it: kubectl apply -f deploy/kubernetes/20-deployment.yaml.

The Recreate strategy means a short outage while the old pod releases the ReadWriteOnce volume. Migrations run automatically on the new pod's startup. Back up first if the release notes mention a schema change.

Hardening already in the manifests

The Deployment follows the same posture as the official image:

  • runs as non-root (65534:65534) with fsGroup on the volume
  • readOnlyRootFilesystem: true, with /tmp as a sized emptyDir
  • allowPrivilegeEscalation: false, all capabilities dropped, seccompProfile: RuntimeDefault
  • no service-account token mounted

These were validated against the published image: it starts, writes SQLite to /data, and serves /readyz under a read-only root filesystem.

Validate before you apply

kubectl apply --dry-run=client -f deploy/kubernetes/10-pvc.yaml
kubectl apply --dry-run=client -f deploy/kubernetes/20-deployment.yaml
kubectl apply --dry-run=client -f deploy/kubernetes/30-service.yaml
kubectl apply --dry-run=client -f deploy/kubernetes/40-ingress.yaml