Skip to content

Production Kubernetes & Storage Deployment ​

This guide covers deploying Arka on Kubernetes (1.23+) using the published OCI Helm Chart (oci://ghcr.io/ccsert/charts/arka) or Kustomize, wiring external PostgreSQL 16 and S3/RustFS/Azure/Filesystem storage, and optionally enabling the isolated arka-scanner sidecar with automated two-stage vulnerability database rotation.

1. Prerequisites & Production Dependencies ​

Before running helm upgrade --install:

  1. PostgreSQL 16: Provision an external HA PostgreSQL 16 database with TLS enabled (sslmode=verify-full). Grant the arka role privileges to run embedded schema migrations and normal DML. Arka uses session-level LISTEN/NOTIFY and pg_advisory_lock—do not place PgBouncer in transaction pooling mode in front of it.
  2. Object Storage (S3 / RustFS / MinIO): Pre-create a private bucket (e.g. arka-blobs) and create credentials scoped to list, read, write, and delete objects in that bucket. Keep storage.s3.autoCreateBucket: false in production. (For Azure Blob or single-replica Filesystem storage, see Sections 6–7.)
  3. Kubernetes Namespace & Runtime Secret: Create the namespace and an arka-runtime Secret containing all required runtime secrets.
bash
# Generate two independent 32-byte secrets once and store them in your secrets manager
CRED_KEY="$(openssl rand -hex 32)"
SIGN_KEY="$(openssl rand -hex 32)"

kubectl create namespace arka
kubectl -n arka create secret generic arka-runtime \
  --from-literal=ARKA_DATABASE_URL='postgres://arka:<url-encoded-password>@postgres.example.com:5432/arka?sslmode=verify-full' \
  --from-literal=ARKA_CREDENTIAL_KEY="$CRED_KEY" \
  --from-literal=ARKA_AUTH_SIGNING_KEY="$SIGN_KEY" \
  --from-literal=ARKA_BOOTSTRAP_ADMIN_PASSWORD='<strong-initial-admin-password>' \
  --from-literal=ARKA_S3_ACCESS_KEY='<s3-access-key>' \
  --from-literal=ARKA_S3_SECRET_KEY='<s3-secret-key>'

To require a static bearer token for metrics on either listener, add --from-literal=ARKA_METRICS_AUTH_TOKEN='<token>' to the runtime Secret.


Image Tag & Digest Rules ​

The Helm Chart (deploy/helm/arka/Chart.yaml, version: 1.0.0, appVersion: "1.0.0") uses structured image blocks for both the server and the optional scanner:

  • image.{repository, tag, digest, pullPolicy} (default repository: ghcr.io/ccsert/arka)
  • scanner.image.{repository, tag, digest, pullPolicy} (default repository: ghcr.io/ccsert/arka-scanner)
  • Leaving tag: "" automatically inherits Chart.AppVersion (matching the installed chart version, including the migration container).
  • Setting a non-empty digest: "sha256:..." takes precedence over tag for immutable rollouts.

The server and scanner production images use the supported Alpine 3.24 stable branch. Local Quickstart builds use the same server Dockerfile. Dependabot checks Docker dependencies in the root and scanner directories weekly.

Minimal Production values-prod.yaml ​

Save your cluster-specific values as values-prod.yaml:

yaml
replicaCount: 2

image:
  repository: ghcr.io/ccsert/arka
  tag: ""          # Empty inherits Chart.AppVersion (e.g. 1.0.0)
  digest: ""       # Optional: pin sha256:... (overrides tag)
  pullPolicy: IfNotPresent

existingSecret: arka-runtime

# Use initContainer so the credential-key patch below covers both migrate and arka
migration:
  mode: initContainer

storage:
  driver: s3
  s3:
    endpoint: https://s3.internal.example.com
    publicEndpoint: ""   # Set to client-reachable HTTPS S3 URL if enabling presign.enabled
    region: us-east-1
    bucket: arka-blobs
    pathStyle: true      # true for RustFS/MinIO; false for AWS S3 virtual-hosted URLs
    autoCreateBucket: false

presign:
  enabled: false
  ttl: 5m
  minBytes: 1048576

ingress:
  enabled: true
  className: nginx
  host: registry.example.com
  tlsSecretName: arka-tls
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: "0"
    nginx.ingress.kubernetes.io/proxy-request-buffering: "off"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "600"

metrics:
  enabled: true
  dedicatedPort: true
  serviceMonitor:
    enabled: false

Wire ARKA_CREDENTIAL_KEY into arka and migrate ​

Important: Because Arka fails closed in production when ARKA_CREDENTIAL_KEY is missing—for both arka migrate and arka serve—and the current Helm templates map individual Secret keys explicitly, inject ARKA_CREDENTIAL_KEY into both containers via a tiny Helm post-renderer (or Kustomize patch).

Save credential-env.patch.yaml:

yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: arka
spec:
  template:
    spec:
      initContainers:
        - name: migrate
          env:
            - name: ARKA_CREDENTIAL_KEY
              valueFrom:
                secretKeyRef:
                  name: arka-runtime
                  key: ARKA_CREDENTIAL_KEY
      containers:
        - name: arka
          env:
            - name: ARKA_CREDENTIAL_KEY
              valueFrom:
                secretKeyRef:
                  name: arka-runtime
                  key: ARKA_CREDENTIAL_KEY

Save arka-post-renderer next to it and make it executable (chmod +x arka-post-renderer):

sh
#!/bin/sh
set -eu
patch_dir=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
stage=$(mktemp -d)
trap 'rm -rf "$stage"' EXIT
cat >"$stage/rendered.yaml"
cp "$patch_dir/credential-env.patch.yaml" "$stage/credential-env.patch.yaml"
cat >"$stage/kustomization.yaml" <<'YAML'
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - rendered.yaml
patches:
  - path: credential-env.patch.yaml
YAML
kubectl kustomize "$stage"

Install and Verify ​

bash
# Install directly from the published OCI Helm Chart (pin the release version)
helm upgrade --install arka oci://ghcr.io/ccsert/charts/arka \
  --version 1.0.0 \
  -n arka \
  -f values-prod.yaml \
  --post-renderer ./arka-post-renderer \
  --wait --timeout 10m

# Verify rollout and live PostgreSQL + S3 readiness
kubectl -n arka rollout status deployment/arka
curl -fsS https://registry.example.com/api/v1/ready

Deploying from a local checkout or air-gapped .tgz: Replace oci://ghcr.io/ccsert/charts/arka --version 1.0.0 with ./deploy/helm/arka or the verified ./arka-1.0.0.tgz chart archive from GitHub Releases.

The manifests in this checkout require an Arka server image that implements /api/v1/health/live and ARKA_METRICS_REQUIRE_AUTH. Pin a compatible published tag or digest, or build the image from this checkout. Verify that a request to the liveness path returns the JSON health response. When the Console is enabled, older images can return HTTP 200 with index.html for the unknown path.

Migration Modes, Scaling & Secret Rotation ​

  • Migrations (hook vs. initContainer): The chart default migration.mode: hook runs a pre-install/pre-upgrade Job (inspect failures with kubectl -n arka logs job/arka-migrate). Setting migration.mode: initContainer runs arka migrate inside each Pod before arka serve (inspect with kubectl -n arka logs <pod> -c migrate) and lets a single Deployment patch inject ARKA_CREDENTIAL_KEY cleanly. PostgreSQL advisory locks serialize concurrent attempts.
  • Scaling & HA: Helm deploys 2 replicas with PodDisruptionBudget (maxUnavailable: 1) and topologySpreadConstraints by default. Enable autoscaling.enabled: true when the Resource Metrics API is available, and size PostgreSQL max_connections for maxReplicas (you can bound per-replica connections with pool_max_conns=25 in ARKA_DATABASE_URL).
  • Probes and shutdown use the same defaults in Helm and Kustomize. Liveness checks /api/v1/health/live independently of PostgreSQL and blob storage. Startup checks PostgreSQL at /api/v1/health. Readiness checks PostgreSQL and the default blob store at /api/v1/ready. The Pod has 45 seconds to terminate. From the start of shutdown, HTTP handlers and background services have up to 39 seconds to finish work that uses PostgreSQL. Trace flushing and pool closure have separate budgets of 2 and 3 seconds.
  • Secret updates: Editing an external existingSecret does not automatically restart Pods—run kubectl -n arka rollout restart deployment/arka after updating it. To rotate ARKA_CREDENTIAL_KEY without downtime, follow Credential Encryption & Rotation.

3. Optional: Enable arka-scanner & Two-Stage Vulnerability DB Rotation ​

The Helm Chart can deploy the isolated arka-scanner Deployment (Syft SBOM + Grype vulnerability engine) alongside an optional scanner.dbUpdater CronJob that keeps the offline Grype database fresh without ever giving the scanner Pod internet egress or write access.

How Two-Stage Rotation Works ​

  1. The scanner.dbUpdater CronJob (default schedule 0 */12 * * *, concurrencyPolicy: Forbid) pulls the new Grype database into a timestamped staging directory under /var/lib/grype/releases/<timestamp>-XXXXXX, validates schema, hash integrity, and build age (maxDbAgeHours: 96), and checks vulnerability.db.
  2. Only after validation passes does it perform a POSIX atomic symlink swap (mv -Tf) on /var/lib/grype/current.
  3. It retains at least keepReleases: 2 generations (active + previous) for instant rollback.
  4. Meanwhile, arka-scanner mounts the PVC read-only (readOnly: true) at /var/lib/grype, reads /var/lib/grype/current, and enforces a zero-egress NetworkPolicy (egress: []).

Setup Steps ​

  1. Create the shared scanner bearer token Secret (key must be token, minimum 16 non-whitespace chars):
    bash
    kubectl -n arka create secret generic arka-scanner \
      --from-literal=token="$(openssl rand -hex 24)"
  2. Provision a PVC (e.g. arka-scanner-grype-db, ReadWriteMany when the CronJob and Scanner Pods can land on different nodes, writable by UID/GID 10001).
  3. Append the scanner block to values-prod.yaml:
yaml
networkPolicy:
  enabled: true   # Optional: enforces egress rules on dbUpdater; Scanner ALWAYS denies all egress

scanner:
  enabled: true
  replicaCount: 1
  image:
    repository: ghcr.io/ccsert/arka-scanner
    tag: ""       # Inherits Chart.AppVersion (e.g. 1.0.0)
    digest: ""
    pullPolicy: IfNotPresent
  existingSecret: arka-scanner
  dbExistingClaim: arka-scanner-grype-db
  dbMaxAllowedBuiltAge: "120h"
  workspaceSize: 2Gi
  dbUpdater:
    enabled: true
    schedule: "0 */12 * * *"
    keepReleases: 2
    maxDbAgeHours: 96
    rolloutRestart: false
    dbSource:
      # Choose at most ONE: internal Grype listing URL OR a direct checksum-qualified archive URL
      # (leave both empty to pull from upstream Grype listing if permitted)
      updateURL: ""
      archiveURL: ""
      proxySecretName: ""    # Optional Secret with HTTPS_PROXY / HTTP_PROXY / NO_PROXY
      caConfigMapName: ""    # Optional ConfigMap with private mirror CA bundle (key: ca.crt)
    networkPolicy:
      # When networkPolicy.enabled=true, allow only DNS + your DB mirror/proxy (+ K8s API if rolloutRestart=true)
      egress: []
  1. Upgrade the release, then seed the empty PVC immediately without waiting for the 12-hour cron window:
bash
kubectl -n arka create job --from=cronjob/arka-scanner-db-updater scanner-db-initial
kubectl -n arka logs -f job/scanner-db-initial

Scrape Scanner DB Metrics (Even When /readyz Returns 503) ​

arka-scanner exposes /metrics on port 8091 and always returns HTTP 200 even when /readyz returns HTTP 503 (expired/missing DB). Configure a Pod-discovery Prometheus job that retains NotReady Pods and alert when arka_scanner_db_age_seconds > 345600 (96 hours — well before Grype's 120-hour expiry):

yaml
scrape_configs:
  - job_name: arka-scanner
    kubernetes_sd_configs:
      - role: pod
        namespaces:
          names: [arka]
    relabel_configs:
      - source_labels:
          - __meta_kubernetes_pod_annotation_prometheus_io_scrape
          - __meta_kubernetes_pod_container_name
          - __meta_kubernetes_pod_container_port_number
        regex: 'true;scanner;8091'
        action: keep
      - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
        target_label: __metrics_path__

For full manual air-gap DB seeding, all 5 arka_scanner_db_* metrics, and SBOM License Compliance Gate configuration, see the External Scanner Guide and Security & License Compliance Guide.


4. Deploy with Kustomize ​

The Kustomize base (deploy/kustomize/base/) pins ghcr.io/ccsert/arka:1.0.0 and uses an initContainer for migrations.

  1. Create namespace arka, Secret arka-runtime (with ARKA_CREDENTIAL_KEY), and TLS Secret arka-tls.
  2. In deploy/kustomize/overlays/prod/, update configmap.yaml (ARKA_BASE_URL, ARKA_S3_ENDPOINT, ARKA_S3_PUBLIC_ENDPOINT), update ingress.yaml host/TLS, and add credential-env.patch.yaml to patches in kustomization.yaml.
  3. Render and apply:
bash
kubectl kustomize deploy/kustomize/overlays/prod
kubectl apply -k deploy/kustomize/overlays/prod
kubectl -n arka rollout status deployment/arka
kubectl -n arka get hpa arka

The production overlay configures an HPA maintaining 3–6 replicas and enables 302 presigned downloads for artifacts >= 1 MiB. To add the standalone Kustomize scanner base, compose deploy/scanner/kustomize.


5. Try the Bundled Helm Dev Stack (Kind / k3s Only) ​

For ephemeral local Kubernetes testing (PostgreSQL 16 + RustFS inside the namespace with emptyDir — do not use in production):

bash
helm upgrade --install arka deploy/helm/arka -n arka-dev --create-namespace \
  -f deploy/helm/arka/values-dev.yaml \
  --post-renderer ./arka-post-renderer \
  --wait --timeout 10m
kubectl -n arka-dev port-forward svc/arka 18080:80

Recreating a dev dependency Pod discards all data. Point credential-env.patch.yaml at the dev Secret (arka-runtime) or set ARKA_ENV=development on the dev patch.


6. Storage Backends & Zero-Copy Download Offload ​

S3 / RustFS & AWS Workload Identity (aws_default) ​

  • Set ARKA_STORAGE_DRIVER=s3, ARKA_S3_ENDPOINT, ARKA_S3_BUCKET, ARKA_S3_REGION, and ARKA_S3_PATH_STYLE (true for RustFS/MinIO, false for AWS S3).
  • For IRSA / EKS Pod Identity without static keys, set ARKA_S3_AUTH_MODE=aws_default and omit ARKA_S3_ACCESS_KEY / ARKA_S3_SECRET_KEY.
  • 302 Presigned Offload: Set presign.enabled: true (ARKA_STORAGE_PRESIGN_REDIRECT=true) and configure storage.s3.publicEndpoint (ARKA_S3_PUBLIC_ENDPOINT) to a client-reachable HTTPS S3 origin while keeping storage.s3.endpoint internal. Preserve the signed host, path, and query parameters through proxies; keep the bucket private.

Azure Blob Storage Pools ​

Pre-create a private Block Blob container. Configure ARKA_STORAGE_DRIVER=azure_blob or add an Azure pool dynamically via arkactl pools create:

bash
arkactl pools create azure-prod --driver azure_blob --auth-mode shared_key \
  --account-name mystorageaccount --container arka-blobs --prefix production
arkactl pools test "$POOL_ID"

Supports shared_key, sas, and default_credential (Managed Identity / Workload Identity). See Azure Blob Storage Pools.

Local Filesystem & X-Accel-Redirect / X-Sendfile ​

Filesystem storage (storage.driver: fs) requires replicaCount: 1, autoscaling.enabled: false, presign.enabled: false, and an existing writable PVC (storage.fs.existingClaim). Behind Nginx or Apache, configure ARKA_TRUSTED_PROXIES and enable pool-level X-Accel-Redirect or X-Sendfile zero-copy delivery—see Filesystem Download Offload.


7. Ingress, Large Uploads, Prometheus & OTLP Tracing ​

  • Large Uploads: Keep Prefix / so /repository/*, /v2/*, and /api/v1/* reach Arka unmodified. For ingress-nginx, the default annotations set proxy-body-size: "0", proxy-request-buffering: "off", and 600s read/send timeouts. For Traefik, omit Buffering middleware and raise entrypoint timeouts. For Gateway API, attach an HTTPRoute to Service port 80 and verify limits on any outer CDN/WAF.
  • OTLP Tracing: Set observability.otlpEndpoint (OTEL_EXPORTER_OTLP_ENDPOINT) to your OTLP/HTTP collector base URL; Arka appends /v1/traces and uses OTEL_SERVICE_NAME (default arka).
  • Private Upstream CA: Mount a PEM bundle read-only and set ARKA_TLS_CA_CERTIFICATES to its file path to trust private HTTPS package upstreams.

Size Temporary Storage for Publishing ​

Each Arka server Pod gets a disk-backed /tmp volume capped at 2 GiB, a 2 GiB ephemeral-storage request for scheduling, and a 3 GiB ephemeral-storage limit. The additional 1 GiB gives container logs and the writable layer room within the Pod's ephemeral-storage budget.

Budget temporary disk per Pod for peak simultaneous publishes multiplied by the largest package accepted by the relevant format. Allow for overlapping copies during storage writes and for other temporary files, such as proxy downloads. Four simultaneous 256 MiB packages can use 1 GiB for a single staging copy or 2 GiB when two copies overlap, before accounting for other temporary files.

Set tmp.sizeLimit, resources.requests.ephemeral-storage, and resources.limits.ephemeral-storage together in Helm. With Kustomize, patch the tmp volume and the arka container resources in the Deployment. Reserve enough node ephemeral storage for the busiest Pods at the planned replica count, and leave headroom above the volume cap in the container limit for logs and writable layers. Kubernetes can evict a Pod when its ephemeral-storage budget or volume cap is exceeded or when the node is under disk pressure.

Arka Server Prometheus Metrics ​

/metrics defaults to the dedicated internal port 9090 in Helm and in the production Kustomize overlay. In Helm, set metrics.dedicatedPort: false to serve it on the main HTTP listener (8080 in the Pod, 80 on the Service). For a standalone server, set ARKA_METRICS_LISTEN_ADDR for a dedicated listener or leave it empty for the main listener. metrics.enabled: false in Helm or ARKA_METRICS_ENABLED=false for the server disables scraping.

With Prometheus Operator installed, set metrics.serviceMonitor.enabled: true and match metrics.serviceMonitor.labels. For either port, set metrics.serviceMonitor.useAuthToken: true and provide a non-empty ARKA_METRICS_AUTH_TOKEN in existingSecret or through secret.metricsAuthToken when the chart manages the Secret. The chart sets ARKA_METRICS_REQUIRE_AUTH=true and the server rejects an empty or whitespace-only token at startup. Standalone Arka deployments can set the same environment variable. For anonymous scraping, omit the token and leave useAuthToken: false. Import deploy/grafana/arka-dashboard.json into Grafana.

Administrators can confirm the configuration at /api/v1/observability/status. metricsMode is main, dedicated, or disabled, and metricsPath is /metrics when enabled. metricsAuthMode is none for an unauthenticated or disabled endpoint, bearer for a token-protected dedicated listener, or bearer_or_admin for a protected main listener that also accepts platform administrators.

From a repository checkout, validate all Helm and Kustomize renders locally:

bash
ARKA_VERIFY_DEPLOY_STRICT=1 ./scripts/verify-deploy.sh

Released under the Apache 2.0 License.