Kubernetes (Helm)

Install Stater on Kubernetes with the signed Helm chart: the Secret, PostgreSQL, ingress, scaling, backups and monitoring.

See it in the tour: Install on your own server

On this page

The chart runs Stater as a Deployment of stateless pods behind a Service and an optional Ingress, with migrations in an init container, probes, a PodDisruptionBudget, optional autoscaling and a ServiceMonitor. It needs Kubernetes 1.27 or later, Helm 3.8 or later, and PostgreSQL 16 or later; 17 recommended (it is what Stater is tested with).

Note. Stater is in early access. The release files and images are not public; request early access to get them.

1. Check and install#

cosign verify ghcr.io/kazarrackt/charts/stater:0.1.0 \
  --certificate-identity-regexp '^https://github.com/Kazarrackt/retail-ops-platform/.github/workflows/release.yml@refs/tags/v' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com
cosign verify ghcr.io/kazarrackt/stater:0.1.0 \
  --certificate-identity-regexp '^https://github.com/Kazarrackt/retail-ops-platform/.github/workflows/release.yml@refs/tags/v' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com

Make the Secret (recommended), then install. Change trustedProxies to your ingress controller's pod network: 10.244.0.0/16 is a common default, but check yours (see Ingress). The chart will not install an Ingress without it.

kubectl create namespace stater
kubectl -n stater create secret generic stater-secrets \
  --from-literal=database-url='postgres://stater:…@db.example.com:5432/stater?sslmode=require' \
  --from-literal=secret-key="$(head -c 32 /dev/urandom | base64)"
helm install stater oci://ghcr.io/kazarrackt/charts/stater --version 0.1.0 -n stater \
  --set publicURL=https://pos.example.com --set existingSecret=stater-secrets \
  --set ingress.enabled=true --set ingress.className=nginx \
  --set trustedProxies=10.244.0.0/16 \
  --set 'ingress.hosts[0].host=pos.example.com' \
  --set 'ingress.tls[0].secretName=pos-tls' --set 'ingress.tls[0].hosts[0]=pos.example.com'
helm test stater -n stater

Keep a copy of secret-key apart from your backups. It encrypts saved integration passwords (email, directory, S3); a restored database without it cannot read them.

Finish setup straight away: until an owner exists, whoever opens Stater first creates one. Or set bootstrapAdmin.username with secrets.bootstrapAdminPassword.enabled=true.

The image and chart are not public: add imagePullSecrets with a token that can read them, and run helm registry login ghcr.io before helm install.

The Secret#

Key Needed What it is
database-url always The PostgreSQL URL. Pods read it from the environment.
secret-key always 32 random bytes in base64: head -c 32 /dev/urandom | base64.
metrics-token secrets.metricsToken.enabled Bearer token for /metrics (16 or more characters).
smtp-password secrets.smtpPassword.enabled The email password.
bootstrap-admin-password secrets.bootstrapAdminPassword.enabled The first owner's password (12 or more characters).
backup-s3-secret-key backup.s3.bucket set The S3 secret key.
backup-key secrets.backupKey.enabled A backup encryption key; without it, one is derived from secret-key.

Every key except database-url reaches the pods as a file under /run/secrets/stater, never as an environment variable.

Without existingSecret, the chart makes the Secret from database.url and makes a secret-key itself. It keeps that Secret on upgrades and when the release is uninstalled, so the key is never replaced. Argo CD, Flux and helm template cannot see a Secret made before, and would make a new key every time: use existingSecret with them (External Secrets, Sealed Secrets or kubectl).

The licence goes in a Secret of its own: kubectl -n stater create secret generic stater-licence --from-file=licence.lic=./shop.lic, then --set licence.existingSecret=stater-licence.

PostgreSQL#

Use a managed PostgreSQL (RDS, Cloud SQL, Azure Database) or an operator such as CloudNativePG. Make the database and its user with stater db init (see Database and backups).

postgresql.enabled=true adds a single PostgreSQL pod with a volume, for evaluation only: no replication, and nothing backs up its volume except Stater's own backups.

PgBouncer in transaction mode breaks live updates (they use LISTEN); use session mode or connect directly.

Ingress#

Live updates are a long-lived server-sent events stream (/api/v1/stream). The chart's default annotations turn off buffering and allow five minutes between reads on ingress-nginx; set the equivalent for other controllers. Use TLS and an https publicURL.

Set trustedProxies to your ingress controller's pod network (such as 10.244.0.0/16) so sign-in limits count each real client rather than the ingress pod; the chart refuses ingress.enabled without it. It is empty by default, which believes no proxy: a wide range such as all the private ones would let any pod, or a client reaching a NodePort or LoadBalancer Service directly, forge its address with an X-Forwarded-For header. NOTES reminds you when it is empty.

Scaling and disruption#

replicaCount is 2, and the PodDisruptionBudget keeps at least one pod during node drains. autoscaling.enabled=true adds a HorizontalPodAutoscaler on CPU. Each pod opens at most 8 database connections plus 2 during a backup, so maxReplicas × 10 must fit PostgreSQL's max_connections; NOTES prints the sum. hashConcurrency (4) bounds the memory password checks take (64 MiB each).

Backups#

Backups run inside Stater, on one pod at a time (they share a database lock). Pods rarely share a volume, so off-site S3 storage is the recommended destination: set backup.s3.* with backup-s3-secret-key in the Secret, or let an owner set it in Admin › Backups. backup.schedule sets the times (02:30 by default), backup.keepDays and backup.keepCount the keeping.

backup.persistence.enabled=true mounts a folder in every pod; it must be ReadWriteMany (NFS, CephFS, EFS, Azure Files), because any pod may make the backup. Its PersistentVolumeClaim is kept when the release is uninstalled. Backups are staged in /tmp, an emptyDir limited to backup.tmpSizeLimit (4Gi): raise it for a large database.

To restore, scale to 0 and run the image once with the same settings; see Database and backups.

Monitoring#

/metrics needs secrets.metricsToken.enabled (see Monitoring). metrics.serviceMonitor.enabled=true adds a ServiceMonitor for the Prometheus Operator that sends the token.

Security#

Pods run as user 65532 with a read-only root file system, no capabilities, the RuntimeDefault seccomp profile and no service account token. Migrations run in an init container; pods starting together take turns through a database lock.

Upgrading and going back are in Upgrading.