Deploy featuremeshd
This guide deploys the featuremeshd services you chose ( Choose what you run ). Serving pods answer your application. Hooks pods run streams, precompute and materialized views. Each is its own Helm release.
Which steps you need
| You run | Steps |
|---|---|
serving only | 1 and 2, then 5 to 7 |
hooks only | 3 and 4, then 5 to 7 |
| both | every step, with one release per service |
| the HTTP proxy | Deploy the HTTP proxy , then 7 |
Steps 5 to 7 and Health is liveness only apply to every service.
Before you start, for every service, have:
- a Kubernetes cluster with Helm, or hosts that run containers;
- your registry's endpoint, project ID and token;
- the passwords of your stores and brokers in Kubernetes secrets;
- the stores your statements read, and your hooks write, prepared ( Prepare the stores ).
For serving, have the prepared statements you will serve, measured (step 1).
For hooks, have a Kafka broker whose ACLs admit your hooks' consumer groups. Have each hook's EXPIRE and RETENTION, and the memory of your stores and pods, sized ( Size RETENTION, EXPIRE and memory ).
Every configuration key is in Configure featuremeshd . featuremeshd reads one YAML file, the path in FEATUREMESHD_CONFIG_PATH. The Helm chart, oci://ghcr.io/featuremesh/charts/featuremeshd, writes that file from the values file of each release.
1. Measure the statements first
For serving.
A production endpoint has a latency and concurrency budget that an analytical job usually does not. Keep the work of each call bounded:
- One key or a small known set per call. A broad keyset, a global sort or window, a large cross product or a high-cardinality aggregation may be valid FeatureQL, but makes an expensive endpoint.
- Few sources and small payloads. A call's cost grows with the data it moves. A few values from Redis and an indexed PostgreSQL table cost little beyond the network calls. Thousands of child rows per key, or large JSON payloads, pay for their serialization and compute.
Measure each prepared statement against production-like sources, indexes, payload sizes and concurrency. Precompute or cache an aggregate when the measurement misses the budget, not before ( Choosing a pattern ). Conformance tests measure the gaps between serving and batch on your stack.
2. Deploy the serving pods
For serving.
The serving install answers your application's calls. Keep hooks off there: serving.hooks.enabled is off by default. A backlog on a serving pod would compete with serving calls ( Replicas and resources ).
Deploy it with the featuremeshd Helm chart, oci://ghcr.io/featuremesh/charts/featuremeshd, and service: serving. The chart writes featuremeshd's file from serving.config and ships none by default: without it, featuremeshd serves nothing. Passwords your sources read go in environment variables (extraEnv), read by SECRET('env', …):
# values-serving.yaml
service: serving
replicaCount: 3
registry:
endpoint: "https://registry.example.com"
serving:
config: |
serving:
enabled: true
sources:
poll_interval: "60s" # registry sync
http:
enabled: true
address: "0.0.0.0:10090"
grpc:
enabled: true
address: "0.0.0.0:10091"
health:
enabled: true
address: "0.0.0.0:10094"
telemetry:
exporters:
otlp:
enabled: true
endpoint: "http://otel-collector:4317"
protocol: "grpc"
extraEnv: # password = SECRET('env', 'PG_PASSWORD') in a database source
- name: PG_PASSWORD
valueFrom:
secretKeyRef: {name: pg-credentials, key: password} helm upgrade --install featuremeshd oci://ghcr.io/featuremesh/charts/featuremeshd \
-f values-serving.yaml --set projectId=$PROJECT_ID --set secret.registryToken=$REGISTRY_TOKEN Its Service, featuremeshd-serving for a release named featuremeshd, load-balances the ports the file turns on: HTTP on 10090 and gRPC on 10091 here. Arrow Flight, on 10093, is on only with serving.flight.enabled ( Configure featuremeshd ).
Point your application at it. Over HTTP or gRPC, the call is in Call a prepared statement . From Python, a ServingClient pairs the managed registry with featuremeshd, and serving.host names the service:
from featuremesh import RegistryDeployment, ServingClient, ServingDeployment, set_default
set_default("registry", RegistryDeployment.MANAGED)
set_default("serving", ServingDeployment.ONPREM)
set_default("serving.host", "http://featuremeshd-serving:10090")
client = ServingClient(access_token="YOUR_ACCESS_TOKEN") 3. Deploy the hooks pods
For hooks.
Deploy hooks on their own with the featuremeshd Helm chart, oci://ghcr.io/featuremesh/charts/featuremeshd, and service: hooks. It runs the image ghcr.io/featuremesh/featuremeshd (by default the release the chart was published with) with hooks and views on, gRPC and Flight off, and HTTP on port 10090 behind a headless Service. Nothing routes serving traffic to it: its HTTP port is the control and status endpoint for the hooks and views it runs.
The chart writes featuremeshd's file, /etc/featuremeshd/config.yaml, from hooks.config. A values file that changes one key there repeats the whole block. Passwords go in environment variables (extraEnv), read by SECRET('env', …). Files, a CA bundle for instance, go in extraVolumes:
# values-hooks.yaml
service: hooks
replicaCount: 2 # the replicas share each hook's consumer group and its queue's lease
registry:
endpoint: "https://registry.example.com"
memoryLimitMb: "3072" # shared by hook batches and view runs
resources:
limits: {memory: 4Gi}
imagePullSecrets: [] # [{name: ghcr-pull}] for a private mirror
hooks:
config: |
serving:
enabled: true
http:
enabled: true
address: "0.0.0.0:10090"
grpc:
enabled: false
flight:
enabled: false
sources:
poll_interval: "60s" # registry sync
hooks:
enabled: true
poison_after: "5m" # a statement reading a clustered store
kafka_group_prefix: "prod." # consumer groups prod.<hook name>
kafka:
max.poll.interval.ms: "600000"
health:
enabled: true
address: "0.0.0.0:10094"
telemetry:
exporters:
otlp:
enabled: true
endpoint: "http://otel-collector:4317"
protocol: "grpc"
extraEnv: # PASSWORD = SECRET('env', 'KAFKA_PASSWORD') in a stream, PG_PASSWORD in a sink
- name: KAFKA_PASSWORD
valueFrom:
secretKeyRef: {name: kafka-credentials, key: password}
- name: PG_PASSWORD
valueFrom:
secretKeyRef: {name: pg-credentials, key: password}
extraVolumes: # SSL_CA = '/etc/kafka/ca.crt' in a stream
- name: kafka-ca
secret: {secretName: kafka-ca}
extraVolumeMounts:
- name: kafka-ca
mountPath: /etc/kafka
readOnly: true Install it with your registry's project and token. It reads the same registry as the serving install:
helm upgrade --install featuremeshd-hooks oci://ghcr.io/featuremesh/charts/featuremeshd \
-f values-hooks.yaml --set projectId=$PROJECT_ID --set secret.registryToken=$REGISTRY_TOKEN Outside Kubernetes, run the same image, or the featuremeshd binary, with FEATUREMESHD_CONFIG_PATH naming a file that holds the hooks.config block above.
- Memory. Set
memoryLimitMbfrom your measurement, withresources.limits.memoryabove it ( Size featuremeshd's memory ). - Shutdown. Keep
shutdown_graceunder the pod'sterminationGracePeriodSeconds, 30 in the chart ( Shutdown ). - Stopping a hook. Drop it, and create it again later ( Consumer groups ).
4. Keep environments apart
For hooks.
- One
kafka_group_prefixper environment, such as"staging."and"prod.", so that two environments never share a consumer group ( Consumer groups ). - One table, key prefix and watermark per writer. The one-writer check is on the sink feature, not on what it points at. Two sinks declared on the same table, Redis key prefix or
WATERMARK_KEYare not caught, nor are two registries, staging and production, whose hooks share a store. Give each environment its own. - One runner per hook. Do not run a featuremeshd and a Python process on the same hook ( Consumer groups ).
5. Reach a pod
For every service.
A control command is FeatureQL text sent to one pod's POST /v1/featureql, and answered by that pod alone, for what it runs: ask each. There is no cluster-wide view, and a restarted pod starts its SHOW SERVING STATUS counters and WRITES over. To watch every pod, alert on the metrics summed over replicas ( Monitor and recover ). The pods are a Deployment's and change names. The headless Service, featuremeshd-hooks-hooks for a release named featuremeshd-hooks (the chart's full name, then -hooks), has no cluster IP and no load balancing: it resolves to every pod's address, one DNS record each. An orchestrator resolves it, picks one address, and keeps it for the calls that follow. A serving pod is reached the same way, by its pods' label app.kubernetes.io/component=serving.
kubectl get pods -l app.kubernetes.io/instance=featuremeshd-hooks,app.kubernetes.io/component=hooks -o name
kubectl port-forward pod/featuremeshd-hooks-7c9f6d5b8-x2kqp 10090:10090 & # one of them
curl -s http://localhost:10090/v1/featureql -H 'content-type: application/json' --data-binary @- <<'JSON'
{"query": "SHOW SERVING STATUS LIKE 'FM.SHOP.%';"}
JSON The rows are in the response's data.rows, an error in its errors. The same body carries SHOW SERVING WRITES LIKE 'FM.SHOP.%' LIMIT 50;, RECOMPILE SERVING; and RECOMPUTE MATERIALIZED VIEW FM.SHOP.REVENUE;. A request times out after 10 seconds. RECOMPUTE answers at once with the run it started ( Run a view from an orchestrator ).
6. Rotate credentials and certificates
For every service.
How a definition names a secret is in Credentials . featuremeshd reads each kind of secret at its own time:
| Kind | featuremeshd reads its secrets | A rotated secret applies |
|---|---|---|
| database or HTTP source | when it loads the source: at start, and when the source's definition changes. A RECOMPILE SERVING that leaves the definition unchanged keeps the loaded source and its connections | at a restart |
| stream | when its hook's consumer starts, again after a failure, and when the hook's definition changes | at the consumer's next start |
| a hook's sink, a queue | once, then again after a write or a queue operation fails, and at a restart. Not at RECOMPILE SERVING | after a failed write, or a restart: keep the old secret valid until every replica has restarted or reconnected |
| a view's sink | at each run | at the next run |
SECRET('env', …) reads an environment variable, and a running pod never sees its environment change: with it, every kind needs a restart. SECRET('file', …) reads a mounted file, which Kubernetes updates in place unless it is mounted with subPath: a kind that reads its secret again without a restart (a stream, a sink, a queue, a view's sink) then picks it up.
The procedures, each starting with both passwords valid:
- A source's secret. Update the secret, then restart the serving pods one by one, and the hooks pods too: hooks read the same sources.
- A stream's password. Update the secret, then restart the hooks pods one by one. With a mounted file, a consumer that fails to authenticate reads it again when it restarts with backoff.
- A sink's or queue's password. Update the secret. Keep the old password valid until every hooks pod has restarted, or has failed a write and reconnected.
- Revoke the old password last, once every pod shows
RUNNINGhooks and loaded sources inSHOW SERVING STATUS. - A private CA for Redis.
SSL_CERT_FILE, an environment variable, names a PEM file read instead of the system's roots, by every TLS client of the process that reads it, not by Redis alone. Make it a bundle of the system's roots and your CA.
7. Protect the port
For every service.
featuremeshd's ports are not authenticated in this version. No token is checked on HTTP (10090), gRPC (10091) or Arrow Flight (10093). On HTTP, POST /v1/featureql takes a statement call or a control command alike. Anyone who reaches port 10090 can call any statement, read the keys and values SHOW SERVING WRITES keeps, recompile, and recompute a view, which rewrites its sinks. A serving pod answers the same SHOW and RECOMPILE commands as a hooks pod.
- Keep every port of every featuremeshd inside the cluster, behind a Kubernetes NetworkPolicy that admits only the clients that need it: your serving callers on the serving pods' 10090, 10091 and 10093, your operators and orchestrator on the hooks pods' 10090. The health port, 10094, needs only the kubelet.
- With personal data in values, set
recent_writes: 0, so that no value stays in memory. - Keep
serving.test_controlsoff in production. It lets a caller set a call'srequest_timeand run the test commands, which produce records and drain queues ( Test commands ).
Permissions for these commands come in a later version ( Limits ).
Health is liveness only
The health endpoint, port 10094, answers the pod's probes while the process runs. Its GET /health returns {"status":"healthy"} ( health ). It checks nothing else.
- It stays healthy while a hook is
STALLED. A stalled hook waits for a store, and restarting the pod would not help. - It does not check that a consumer still holds its partitions, or that a drain still runs.
- It does not check the registry sync.
Alert on the metrics for the rest ( Monitor and recover ).
Check the deployment
On each pod ( Reach a pod ):
SHOW SERVING STATUSlists every definitionLOADEDorRUNNING, and theREGISTRY_SYNCrow isOK( Statuses by kind ).- On a hooks pod, each event hook lists its partitions, with
lagfalling. - From outside the cluster, port 10090 does not answer.
Common failures
- A definition in
ERRORwith a property named inMESSAGE: a secret the pod cannot read. Set the variable, restart the pod, and recompile ( A missing secret, by kind ). - A hook
STALLEDon a topic: the topic does not exist, or the broker's ACLs refuse the group ( Find what holds a hook ). - A pod that exits at start, its error in the log: a configuration featuremeshd refuses, such as a reserved
kafkakey ( Consumer settings ). - Hooks listed
STOPPED:serving.hooks.enabledis off on that pod. That is right on a serving pod.
Related
- Prepare the stores : what Redis and the databases need before hooks write to them.
- Deploy the HTTP proxy : the proxy for warehouse clients, a service of its own.
- Size
RETENTION,EXPIREand memory : the settings and the memory to size before going live. - Monitor and recover : the alerts to set once deployed.
- Change and replay : rolling upgrades and changes.