Kubernetes & OpenShift
For production workloads, Alquimia Platform runs as a Kubernetes workload with separate master and worker deployments. This separates request intake from execution, lets you scale each role independently, and supports Vault-backed dynamic credentials and SPIFFE workload identity.
Deployment topology
Section titled “Deployment topology”The runtime does not provision its own backing services. The manifests in alquimia-runtime/k8s deploy the master, workers, services, and network policies into the alquimia-runtime namespace. Everything else must already exist, and backing services are expected in namespaces labelled alquimia.ai/namespace-role: backend.
flowchart TB
clients["Client apps · browsers · channels"]
llm["LLM, MCP and A2A endpoints<br/>HTTPS 443"]
subgraph cluster["Kubernetes / OpenShift cluster"]
router["Ingress controller / OpenShift Router<br/>TLS termination"]
subgraph ns_studio["ns: alquimia-studio"]
studio["Studio :3000"]
end
subgraph ns_rt["ns: alquimia-runtime"]
master["master ×1<br/>HTTP API :8080 · registry writer"]
workers["workers ×N<br/>alquimia-core execution"]
end
kafka[("Kafka<br/>alquimia.events · .dlq")]
subgraph ns_backend["backend namespaces · alquimia.ai/namespace-role=backend"]
pg[("PostgreSQL")]
redis[("Redis")]
qdrant[("Qdrant<br/>master only")]
s3[("S3 object store")]
vault["Vault"]
oci["OCI registry"]
end
subgraph ns_platform["platform services"]
kc["Keycloak"]
spire["SPIRE"]
otel["OTel Collector"]
end
end
clients --> router
router --> studio
router --> master
studio --> master
master -->|"signed CloudEvents"| kafka
kafka -->|"consumer group"| workers
master --> ns_backend
workers --> ns_backend
workers -->|"egress 443"| llm
ns_platform -.->|"OIDC · SVIDs · OTLP"| ns_rt
Solid arrows are request and data paths. The dotted arrow covers identity and telemetry: Keycloak token validation, SPIFFE SVIDs over the CSI socket, and OTLP on 4317/4318. Qdrant is reached only by the master; the worker network policy does not grant Qdrant egress.
| Role | Responsibility | Scaling driver |
|---|---|---|
| Master | Accepts HTTP requests, manages registry, publishes events | Fixed at exactly 1 replica (Recreate strategy) |
| Worker | Consumes events and executes agents | Inference throughput, up to the alquimia.events partition count (6) |
Workers are stateless. You can add replicas to increase throughput without changing the master deployment, up to the number of partitions on alquimia.events; extra workers stay idle.
The master is the single writer of the TinyDB registry (protected by a Redis Redlock). Run exactly one master replica with the Recreate deployment strategy; do not scale or autoscale it. The Recreate strategy is required both for RWO PVC attachments and because two master pods would race as dual registry writers.
Registry distribution
Section titled “Registry distribution”The registry lives on the master and is mirrored to object storage so workers can read it. Every pod uses rclone init containers and sidecars for this:
flowchart LR
subgraph master_pod["master pod"]
m_init["init: create-bucket<br/>init: fetch-registry<br/>rclone copy --ignore-existing"]
m_rt["alquimia-runtime<br/>registry R/W"]
m_sync["sidecar: s3-sync<br/>rclone sync local → S3"]
end
s3[("S3 bucket<br/>registry/ prefix")]
subgraph worker_pod["worker pod ×N"]
w_init["init: fetch-registry<br/>rclone sync S3 → local"]
w_sync["sidecar: s3-sync<br/>rclone sync S3 → local"]
w_rt["alquimia-runtime<br/>registry read-only"]
end
s3 --> m_init --> m_rt
m_rt --> m_sync --> s3
s3 --> w_init --> w_rt
s3 --> w_sync --> w_rt
Both master and worker pods run an init container that pulls the published registry from S3 before the runtime starts. The init container exits with the rclone return code, so Kubernetes restarts the pod when S3 is unavailable, except for exit code 3 (no registry published yet), which is treated as a successful empty start. The sidecars resync every SYNC_INTERVAL seconds (default 30), so registry changes reach workers with that delay.
Deployment overlays
Section titled “Deployment overlays”The runtime repository provides overlays for different environments:
| Overlay | Use |
|---|---|
kubernetes | Vanilla Kubernetes without admission policies. |
production | Vanilla Kubernetes with Kyverno admission policies in Enforce mode (image signature verification and pod security). |
openshift | OpenShift / ROSA; relies on OpenShift Security Context Constraints (SCCs) instead of Kyverno. Master registry on a PVC. |
spire-openshift | Deploys the SPIRE manifests (k8s/spire) with the agent patches OpenShift needs; used for SPIFFE workload identity, separately from the runtime overlay. |
Two further kustomizations are applied separately: k8s/kafka-config (Strimzi KafkaTopic and KafkaUser resources, applied into the Kafka cluster’s namespace) and k8s/autoscaling (a KEDA ScaledObject, shipped paused).
OpenShift specifics
Section titled “OpenShift specifics”Always deploy through the openshift overlay on OpenShift, never k8s/base directly. Review these points before the first apply:
- SCC. The overlay removes the fixed
runAsUser/runAsGroup/fsGroup: 1000values from the base so therestricted-v2SCC can inject a UID from the namespace range. Check which SCC each pod was admitted under withoc get pod <pod> -o jsonpath='{.metadata.annotations.openshift\.io/scc}'. Runtime pods should not needanyuidorprivileged. - Registry PVC. The master’s registry is mounted from a PVC called
alquimia-registry-s3, which the overlay does not create. Create an RWO claim before applying. - Image tag. The overlay pins
docker.io/alquimiaai/runtimeto a specific tag inkustomization.yaml. Set it to the release you are deploying, preferably by digest, and mirror the image into your internal registry. - Sidecar images. The
rcloneinit containers and sidecars referencedocker.io/rclone/rclone:latest. In production, mirror this image and pin it by digest so it passes registry allow-lists and stays reproducible. - Cluster-specific patches. Several overlay patches encode one reference environment: the Kubernetes API egress rule (ROSA hosted control plane IPs), a Postgres colocated in the runtime namespace with label
app: postgresql, and Redis pods labelledapp: redis-stack-server. Adapt them to your cluster’s labels and addresses, or remove them. - Routes. OpenShift exposes the master through a
Routerather than anIngress. Use edge or re-encrypt TLS termination:oc create route edge alquimia-runtime --service=alquimia-runtime --hostname=api.alquimia.<your-domain>. - SPIRE. The SPIRE agent and SPIFFE CSI driver need the
privilegedSCC (host PID, host network, andhostPath). Thespire-openshiftoverlay grants it only to those two service accounts and labels theCSIDriversorestricted-v2workloads can mount it.
Security considerations
Section titled “Security considerations”- Use projected service-account tokens (audience
vault) and the Kubernetes Vault auth method for runtime services. Set bothVAULT_K8S_ROLE(runtime) andVAULT_AUTH_ROLE(alquimia-coresecret resolver); the manifests do not use a staticVAULT_TOKEN. - Bind Vault roles to one Kubernetes ServiceAccount each. Master and worker use separate ServiceAccounts, and the worker’s ServiceAccount has
automountServiceAccountToken: falseso worker pods cannot mount the Kubernetes API token by default. - Use SPIFFE/SPIRE and the JWT Vault auth method for per-agentspace agent identities. On OpenShift, SPIRE
ClusterStaticEntryRBAC and the admission policy that protects it live in thespire-openshiftoverlay. - Enable image signature verification in production overlays. Agentspace and Boltzmann brain pulls also require a cosign key (
ALQUIMIA_OCI_COSIGN_PUBKEY) becauseALQUIMIA_OCI_SIGNATURE_POLICYdefaults torequired. - Store sensitive values in Vault, not in ConfigMaps or environment variables.
- Every container runs with a read-only root filesystem, all capabilities dropped, and the
RuntimeDefaultseccomp profile. Writable paths are limited to/tmp,/var/lib/alquimia/registry, and/var/lib/alquimia/cache. - Pin all sidecar and utility images by digest in production overlays, including
rclone, SPIRE, the SPIFFE CSI driver, and busybox. - Restrict worker egress with NetworkPolicy and, where possible, an egress proxy or firewall so workers can reach only approved LLM, MCP, identity, and backend destinations.
Network policies
Section titled “Network policies”The base manifests ship a default-deny policy for the alquimia-runtime namespace plus explicit allow rules:
| Policy | Allows |
|---|---|
default-deny-all | Nothing: denies all ingress and egress for every pod in the namespace. |
allow-dns | DNS to kube-dns and the OpenShift DNS daemonset. |
allow-runtime-health-probes | Kubelet probes on TCP 8080. |
allow-master-ingress | TCP 8080 to the master from the router (network.openshift.io/policy-group: ingress) and from the alquimia-studio namespace. |
allow-master-to-backends | Master egress to PostgreSQL, Redis, Qdrant, Alarik, Vault, Kafka, and the OCI registry in backend namespaces. |
allow-worker-to-backends | The same for workers, without Qdrant. |
allow-worker-llm-mcp-egress | Worker egress to any address on TCP 443, for LLM and MCP endpoints. |
allow-otel | OTLP egress on 4317/4318 to pods labelled opentelemetry-collector or otel-collector. |
Backend rules match on both a namespace label and a pod label. For example, the blob-store rule allows TCP 8080 to pods labelled app.kubernetes.io/name: alarik in namespaces labelled alquimia.ai/namespace-role: backend. The reference stack uses Alarik on that port. If your blob store runs elsewhere, label its namespace or add an equivalent rule:
apiVersion: networking.k8s.io/v1kind: NetworkPolicymetadata: name: allow-runtime-to-objectstore namespace: alquimia-runtimespec: podSelector: matchExpressions: - key: role operator: In values: [master, worker] policyTypes: - Egress egress: - to: - namespaceSelector: matchLabels: alquimia.ai/namespace-role: backend podSelector: matchLabels: app.kubernetes.io/name: alarik ports: - protocol: TCP port: 8080Runtime pods are selected by the role label (master or worker) and app: alquimia-runtime.
Before deploying
Section titled “Before deploying”- Provision a PostgreSQL database, Redis cache, Qdrant vector store, Kafka cluster, and object store. Size PostgreSQL
max_connectionsfor the runtime’s per-process pools (see Runtime configuration). - Label backend namespaces
alquimia.ai/namespace-role=backendand check that backend pods carry theapp.kubernetes.io/namelabels the network policies expect. - Apply
k8s/kafka-configto create thealquimia.events(6 partitions) andalquimia.events.dlqtopics and the master and workerKafkaUserACLs, then confirm the topic reports 6 partitions. - Set up Vault with the Kubernetes auth method. Bind separate Vault roles to the
alquimia-runtime-masterandalquimia-runtime-workerServiceAccounts, configure policies and secrets, and setautomountServiceAccountToken: falseon the worker ServiceAccount. - Generate the
KAFKA_SIGNING_KEYandENCRYPTION_KEY, and the cosign key pair used to sign agentspaces and Boltzmann brains. - Optionally deploy SPIRE (
spire-openshiftoverlay on OpenShift) and Keycloak. - Create the namespace, image pull secret, and, on OpenShift, the
alquimia-registry-s3PVC. - Configure an Ingress or Route for the master API, and point OTLP endpoints at your collector.
Next steps
Section titled “Next steps”- Enterprise on OpenShift — reference architecture with supported operators.
- Configuration — configure the runtime for your cluster.
- Scaling & production — tune throughput and reliability.
- Vault policies — set up Vault for dynamic credentials.