Skip to content

Deploy with operators

This guide installs the reference architecture on an OpenShift cluster. All resources are kept in Git and applied by OpenShift GitOps. The oc commands below show what each step produces and are useful for verification.

Operators install in dependency order. In OpenShift GitOps, express each layer as an Argo CD sync wave.

flowchart TB
  w0["Wave 0 · Cluster foundations<br/>OpenShift GitOps · cert-manager · ODF · user workload monitoring"]
  w1["Wave 1 · Operators<br/>Streams for Kafka · PostgreSQL · Redis Enterprise · Qdrant · MongoDB<br/>Red Hat build of Keycloak · Vault · OpenTelemetry · Tempo · Logging<br/>Custom Metrics Autoscaler · SPIRE / ZTWIM"]
  w2["Wave 2 · Backing service instances<br/>Kafka cluster · PG clusters · Redis DB · Qdrant · MongoDB · Vault HA<br/>Keycloak realm · ObjectBucketClaims · OTel Collector · TempoStack"]
  w3["Wave 3 · Configuration<br/>KafkaTopics + KafkaUsers · Vault auth, roles, policies<br/>SPIRE registrations · secrets projected into alquimia-runtime"]
  w4["Wave 4 · Alquimia<br/>runtime overlay · Studio · TrustLens · Routes · EgressFirewall"]
  w5["Wave 5 · Scale and verify<br/>unpause KEDA ScaledObject · smoke tests · alerts"]
  w0 --> w1 --> w2 --> w3 --> w4 --> w5

Install every operator through an OLM Subscription. Set installPlanApproval: Manual for operators that manage data (Kafka, PostgreSQL, Redis, Qdrant, MongoDB, Vault) so upgrades happen only in a planned window.

apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: amq-streams
namespace: openshift-operators
spec:
channel: stable
name: amq-streams
source: redhat-operators
sourceNamespace: openshift-marketplace
installPlanApproval: Manual

List the package names and channels in your catalog with oc get packagemanifests -n openshift-marketplace. Disconnected clusters need these catalogs and images mirrored first, using oc-mirror.

Create the namespaces from the namespace layout and label the backend ones:

Terminal window
for ns in kafka alquimia-postgres alquimia-redis alquimia-qdrant vault; do
oc label namespace "$ns" alquimia.ai/namespace-role=backend --overwrite
done

The cluster name, listener port, and authentication mode must match k8s/kafka-config and k8s/autoscaling:

apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaNodePool
metadata:
name: dual-role
namespace: kafka
labels:
strimzi.io/cluster: alquimia-default
spec:
replicas: 3
roles: [controller, broker]
storage:
type: jbod
volumes:
- id: 0
type: persistent-claim
size: 100Gi
deleteClaim: false
---
apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
name: alquimia-default
namespace: kafka
annotations:
strimzi.io/node-pools: enabled
strimzi.io/kraft: enabled
spec:
kafka:
rack:
topologyKey: topology.kubernetes.io/zone
listeners:
- name: tls
port: 9093
type: internal
tls: true
authentication:
type: tls
authorization:
type: simple
config:
default.replication.factor: 3
min.insync.replicas: 2
offsets.topic.replication.factor: 3
transaction.state.log.replication.factor: 3
transaction.state.log.min.isr: 2
message.max.bytes: 10485760 # >= runtime KAFKA_MAX_REQUEST_SIZE
entityOperator:
topicOperator: {}
userOperator: {}
kafkaExporter:
topicRegex: "alquimia\\..*"
groupRegex: "alquimia-.*"

Then apply the runtime’s topics and users, and confirm that the topic reconciled with 6 partitions:

Terminal window
oc apply -k k8s/kafka-config # namespace is fixed to "kafka" in its kustomization
oc get kafkatopic alquimia-events -n kafka -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}'

The User Operator writes each user’s client certificate to a Secret named after the user (alquimia-master, alquimia-worker) in the kafka namespace. The cluster CA that signs the broker certificates is in alquimia-default-cluster-ca-cert. In alquimia-runtime, the runtime and KEDA expect alquimia-master-tls and alquimia-worker-tls Secrets with ca.crt (cluster CA), user.crt, and user.key. Build them with the External Secrets Operator’s Kubernetes provider or the Vault Secrets Operator. Strimzi rotates client certificates, so the copies have to refresh automatically.

apiVersion: objectbucket.io/v1alpha1
kind: ObjectBucketClaim
metadata:
name: alquimia-blobs
namespace: alquimia-runtime
spec:
generateBucketName: alquimia-blobs
storageClassName: openshift-storage.noobaa.io
---
apiVersion: objectbucket.io/v1alpha1
kind: ObjectBucketClaim
metadata:
name: alquimia-registry
namespace: alquimia-runtime
spec:
generateBucketName: alquimia-registry
storageClassName: openshift-storage.noobaa.io

Each claim produces a ConfigMap (BUCKET_HOST, BUCKET_NAME, BUCKET_PORT) and a Secret (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY). Map them into the alquimia-s3 Secret keys the runtime reads: BLOB_S3_ENDPOINT_URL (https://…), BLOB_S3_ACCESS_KEY, BLOB_S3_SECRET_KEY, BLOB_S3_BUCKET_NAME, REGISTRY_S3_BUCKET_NAME, and BLOB_S3_PROVIDER=Minio.

Also create the master’s registry claim, which the openshift overlay mounts but does not create:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: alquimia-registry-s3
namespace: alquimia-runtime
spec:
accessModes: [ReadWriteOnce]
storageClassName: ocs-storagecluster-ceph-rbd
resources:
requests:
storage: 5Gi
apiVersion: k8s.keycloak.org/v2alpha1
kind: Keycloak
metadata:
name: alquimia-sso
namespace: keycloak
spec:
instances: 3
db:
vendor: postgres
host: keycloak-db-rw.keycloak.svc
usernameSecret: { name: keycloak-db-app, key: username }
passwordSecret: { name: keycloak-db-app, key: password }
http:
tlsSecret: keycloak-tls # issued by cert-manager
hostname:
hostname: sso.apps.example.com

Create the realm with a KeycloakRealmImport, or import keycloak-realm.json from the runtime repository. It needs a confidential client for Studio, a client for the runtime (KEYCLOAK_CLIENT_ID), the role and agentspace claims described in Authentication & authorization, and service-account clients for machine callers.

Give the master and workers their own service accounts so Vault can tell them apart. The base manifests run both under alquimia-runtime-sa, so add two ServiceAccounts and a patch to your overlay. List the patch after the openshift overlay’s resource-limit patches, because those also set serviceAccountName:

# overlays/<your-env>/patches/split-service-accounts.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: alquimia-runtime-master
namespace: alquimia-runtime
spec:
template:
spec:
serviceAccountName: alquimia-runtime-master
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: alquimia-runtime-worker
namespace: alquimia-runtime
spec:
template:
spec:
serviceAccountName: alquimia-runtime-worker

Add the new service accounts as subjects of any RoleBinding that names alquimia-runtime-sa, such as the agentspace provisioner binding. Then turn on Kubernetes auth and bind each Vault role to one service account, using the vault audience that the projected token requests:

Terminal window
vault auth enable kubernetes
vault write auth/kubernetes/config kubernetes_host="https://kubernetes.default.svc"
for role in master worker; do
vault write auth/kubernetes/role/alquimia-runtime-$role \
bound_service_account_names=alquimia-runtime-$role \
bound_service_account_namespaces=alquimia-runtime \
audience=vault \
token_policies=alquimia-runtime-$role \
token_ttl=1h
done

See Vault policies for policy bodies, the JWT auth method for agentspace identities, and the database secrets engine.

Telemetry pipeline (Red Hat build of OpenTelemetry)

Section titled “Telemetry pipeline (Red Hat build of OpenTelemetry)”

Name the collector otel so its pods are labelled app.kubernetes.io/name: otel-collector, which the runtime’s allow-otel NetworkPolicy already selects. Check with oc get pods -n alquimia-observability --show-labels.

apiVersion: opentelemetry.io/v1beta1
kind: OpenTelemetryCollector
metadata:
name: otel
namespace: alquimia-observability
spec:
mode: deployment
replicas: 2
observability:
metrics:
enableMetrics: true # ServiceMonitors for user workload monitoring
config:
receivers:
otlp:
protocols:
grpc: { endpoint: 0.0.0.0:4317 }
http: { endpoint: 0.0.0.0:4318 }
processors:
memory_limiter: { check_interval: 1s, limit_percentage: 80, spike_limit_percentage: 25 }
batch: {}
exporters:
prometheus:
endpoint: 0.0.0.0:8889
resource_to_telemetry_conversion: { enabled: true }
otlp/tempo:
endpoint: tempo-alquimia-distributor.alquimia-observability.svc:4317
tls:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt
# Logs: export to your LokiStack's OTLP endpoint (otlphttp + bearer
# token auth), or rely on OpenShift Logging collecting container stdout.
service:
pipelines:
metrics: { receivers: [otlp], processors: [memory_limiter, batch], exporters: [prometheus] }
traces: { receivers: [otlp], processors: [memory_limiter, batch], exporters: [otlp/tempo] }

Point the runtime and Studio at the collector’s OTLP HTTP port, for example OTEL_COLLECTOR_ENDPOINT=http://otel-collector.alquimia-observability.svc:4318/v1/metrics and the matching /v1/traces and /v1/logs endpoints.

Build an openshift-based overlay for each environment and apply it through Argo CD:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: alquimia-runtime-production
namespace: openshift-gitops
annotations:
argocd.argoproj.io/sync-wave: "4"
spec:
project: alquimia
source:
repoURL: https://git.example.com/platform/alquimia-deploy.git
targetRevision: main
path: overlays/production # bases on alquimia-runtime/k8s/overlays/openshift
destination:
server: https://kubernetes.default.svc
namespace: alquimia-runtime
syncPolicy:
syncOptions: [CreateNamespace=false, ServerSideApply=true]

In your environment overlay:

  • Set images to the runtime release in Quay, pinned by digest, and mirror rclone/rclone and the SPIRE images too.
  • Replace the secretGenerator entries, which read plaintext .secrets/* files, with ExternalSecret or VaultStaticSecret resources that produce the same Secret names.
  • Remove the reference environment’s cluster-specific patches: the ROSA API-server IPs, the colocated app: postgresql rules, and the redis-stack-server labels. Add label-fix patches for your operator-managed backends instead.
  • Set ALQUIMIA_KNOWLEDGE_PROVIDER, AUTH_PROVIDER=keycloak, TLS URLs (rediss://, https://, sslmode=verify-full), and OTEL_EXCLUDED_ATTRIBUTES in the alquimia-config ConfigMap.

The base manifests do not mount Kafka client certificates. Add a patch like this for the worker, and an equivalent one for the master that uses alquimia-master-tls:

apiVersion: apps/v1
kind: Deployment
metadata:
name: alquimia-runtime-worker
namespace: alquimia-runtime
spec:
template:
spec:
volumes:
- name: kafka-tls
secret:
secretName: alquimia-worker-tls
defaultMode: 0440
containers:
- name: alquimia-runtime
env:
- { name: KAFKA_BOOTSTRAP_SERVERS, value: "alquimia-default-kafka-bootstrap.kafka.svc:9093" }
- { name: KAFKA_SECURITY_PROTOCOL, value: SSL }
- { name: KAFKA_SSL_CA_FILE, value: /etc/alquimia/kafka/ca.crt }
- { name: KAFKA_SSL_CERT_FILE, value: /etc/alquimia/kafka/user.crt }
- { name: KAFKA_SSL_KEY_FILE, value: /etc/alquimia/kafka/user.key }
volumeMounts:
- { name: kafka-tls, mountPath: /etc/alquimia/kafka, readOnly: true }

Expose the master with a re-encrypt or edge Route:

apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: alquimia-runtime
namespace: alquimia-runtime
annotations:
haproxy.router.openshift.io/timeout: 10m # long-lived SSE streams
spec:
host: api.alquimia.example.com
to: { kind: Service, name: alquimia-runtime }
port: { targetPort: http }
tls:
termination: edge
insecureEdgeTerminationPolicy: Redirect

Restrict internet egress to approved destinations:

apiVersion: k8s.ovn.org/v1
kind: EgressFirewall
metadata:
name: default # one per namespace, must be named "default"
namespace: alquimia-runtime
spec:
egress:
- type: Allow
to: { dnsName: sso.apps.example.com } # Keycloak Route used by the master
- type: Allow
to: { dnsName: api.openai.com } # each approved model or MCP provider
- type: Deny
to: { cidrSelector: 0.0.0.0/0 }

If AGENTSPACE_PROVISIONING_ENABLED=true and the cluster has a hosted control plane, also allow the API server’s endpoint address.

The Studio image’s default command runs chown and su-exec as root, and the restricted-v2 SCC rejects both. On OpenShift, override the command, use MongoDB rather than the embedded NeDB store, and give Next.js a writable cache directory:

apiVersion: apps/v1
kind: Deployment
metadata:
name: alquimia-studio
namespace: alquimia-studio
spec:
replicas: 2
selector:
matchLabels: { app: alquimia-studio }
template:
metadata:
labels: { app: alquimia-studio }
spec:
containers:
- name: studio
image: quay.example.com/alquimia/studio@sha256:<digest>
command: ["node", "server.js"]
ports:
- { name: http, containerPort: 3000 }
envFrom:
- secretRef: { name: alquimia-studio } # DATABASE_URL, AUTH_KEYCLOAK_*, NEXTAUTH_SECRET, ALQUIMIA_ASSISTANT_API_KEY
env:
- { name: DB_STRATEGY, value: mongo }
- { name: AUTH_STRATEGY, value: keycloak }
- { name: NEXTAUTH_URL, value: "https://studio.apps.example.com" }
- { name: NEXT_PUBLIC_APP_URL, value: "https://studio.apps.example.com" }
- { name: ASSISTANT_BASEURL, value: "http://alquimia-runtime.alquimia-runtime.svc" }
readinessProbe:
httpGet: { path: /api/health, port: http }
livenessProbe:
httpGet: { path: /api/health, port: http }
securityContext:
allowPrivilegeEscalation: false
capabilities: { drop: [ALL] }
volumeMounts:
- { name: next-cache, mountPath: /app/.next/cache }
volumes:
- name: next-cache
emptyDir: {}

Expose Studio with its own edge Route. Server actions accept bodies up to 10 MB, so make sure any proxy in front of the router allows that. If you turn on enterprise evaluations (ENTERPRISE=true), keep RED_TEAMING_API_URL internal-only and set RED_TEAMING_WEBHOOK_IP_HEADER to the header your router forwards.

With the Custom Metrics Autoscaler operator and a KedaController instance in openshift-keda, apply k8s/autoscaling and remove the autoscaling.keda.sh/paused annotation. The ScaledObject scales workers between 2 and 6 based on consumer lag on alquimia.events (threshold 5).

  1. Check that all pods were admitted under restricted-v2, apart from the SPIRE agent and CSI driver: oc get pods -n alquimia-runtime -o custom-columns=NAME:.metadata.name,SCC:.metadata.annotations.openshift\.io/scc
  2. Check that the master is ready: curl https://api.alquimia.example.com/health/readiness.
  3. Run an inference and check that workers consume it. In Observe → Metrics, query the Kafka Exporter metric kafka_consumergroup_lag{consumergroup="alquimia-workers"}; lag should return to 0. The cluster above has only a TLS listener, so any kafka-consumer-groups.sh command needs a client config with the TLS settings.
  4. Check that alquimia.events.dlq stays empty. Messages there usually mean a KAFKA_SIGNING_KEY mismatch.
  5. Check that traces appear in Tempo, metrics in the OpenShift console under Observe → Metrics, and that the alquimia-secret-audit alerts are loaded.