Run in production

Run KVStash on Kubernetes

The kvblockd Helm chart deploys the daemon as a StatefulSet with its config in a ConfigMap and its tenants in a Secret. No operator, no sidecars.

Last updated

What the chart deploys

  • StatefulSet running the daemon, with readiness and liveness probes on /healthz.
  • Two Services: kvblockd for engines and Prometheus (ports 9440 and 9442), and kvblockd-headless for a stable name per pod.
  • ConfigMap with the daemon config, and a Secret with namespaces.yaml.
  • Optional: a volume per pod for the NVMe tier, S3 settings, hugepages, and an S3-compatible listener.

The chart refuses settings that cannot work instead of deploying a broken pod: S3 without NVMe, NVMe without a budget, hugepages in the config without the hugepages resource, a hugepage count smaller than the arena, S3 with more than one replica, and an empty tenant list.

Download the daemon from the install page: static binaries for Linux x86-64 and arm64 (macOS arm64 for development), with SHA-256 checksums, or run curl -fsSL https://kvstash.com/install.sh | sh. The container image and Helm chart are available on request.

Install

values.yaml
# values.yaml: DRAM-only store, the first run
image:
  repository: REGISTRY/kvblockd      # the image you received or pushed
  tag: "VERSION"
config:
  dramArenaBytes: 17179869184        # 16 GiB hot tier
resources:
  requests: { cpu: "4", memory: 18Gi }
  limits:   { memory: 18Gi }          # above the arena: the daemon's own overhead is small
namespaces:
  entries:
    - name: vllm
      id: 2
      token_sha256: "SHA256_OF_THE_TOKEN"   # echo -n TOKEN | shasum -a 256
Shell
helm install kvblockd ./kvblockd-chart -n kvstash --create-namespace -f values.yaml
kubectl -n kvstash rollout status statefulset/kvblockd
kubectl -n kvstash port-forward svc/kvblockd 9442:9442 &
curl -s 127.0.0.1:9442/healthz     # ok

The image has no shell, so debug through the metrics port and kvbctl from another pod.

NVMe tier

Turn on persistence to give each pod its own volume. Blocks that reached NVMe then survive a pod restart: on start, the daemon rebuilds its index from the volume.

values.yaml
persistence:
  enabled: true
  storageClassName: local-nvme       # a class backed by local NVMe for real numbers
  size: 1000Gi
  maxBytes: 1030792151040            # 960 GiB: the daemon's budget, below the volume size

Use a storage class backed by local NVMe. A network-attached volume works, but reads from it are slower and the tier sizing advice on the NVMe tier assumes local flash.

S3 tier with IRSA

The daemon reads AWS credentials only from its environment: on EKS, annotate the service account with an IAM role. The role needs s3:PutObject, s3:GetObject and s3:DeleteObject on the bucket's objects, plus s3:ListBucket and s3:GetBucketVersioning on the bucket itself, which must be unversioned. See the S3 tier policy.

values.yaml
serviceAccount:
  annotations:
    eks.amazonaws.com/role-arn: arn:aws:iam::123456789012:role/kvblockd-s3
persistence:
  enabled: true                      # S3 spills sealed NVMe segments, so NVMe is required
  size: 1000Gi
  maxBytes: 1030792151040
s3:
  enabled: true
  bucket: my-kv-cold
  region: us-east-1
  # nodeId defaults to the release name; it must be unique per daemon
Add a lifecycle rule to the bucket

Objects left behind by restarts are cleaned up by an expiration rule on the bucket, not by the daemon. Without one, storage cost grows in normal operation. Start with 7 days; details on the S3 tier.

Hugepages

For arenas above about 8 GiB, map the arena on 2 MiB hugepages. Reserve the pages on the nodes first (vm.nr_hugepages), then:

values.yaml
config:
  dramArenaBytes: 17179869184        # 16 GiB
  dramHugepages: true
hugepages:
  enabled: true
  count: 8192                        # 8192 x 2 MiB = 16 GiB, at least the arena

With hugepages on, the arena is charged to the hugepages-2Mi resource instead of pod memory.

Connect engines

Engines in the cluster reach the store through the service name:

Engine config
# inside the cluster, from an engine pod: the same address under each connector's key
"kvblockd_endpoint": "kvblockd://kvblockd.kvstash.svc:9440"                    # vLLM (vllm-kvblockd)
"endpoint": "kvblockd://kvblockd.kvstash.svc:9440"                             # SGLang (sglang-kvblockd)
"remote_storage_plugin.kvblockd.url": "kvblockd://kvblockd.kvstash.svc:9440"   # LMCache (lmcache-kvblockd)
  • One store per release is the simple setup. Each pod keeps its own blocks, so with more than one replica the load-balanced service would spread an engine's connections across stores that do not share data.
  • For several stores, point each group of engines at one pod through the headless service, for example kvblockd-0.kvblockd-headless.kvstash.svc:9440, or install one release per group.
  • Restrict the data port to engine pods with a NetworkPolicy; tokens cross it in clear text.
  • Prometheus scrapes the metrics port of the kvblockd service. Import the Grafana dashboard.

Values reference

  • replicaCountdefault: 1

    Pods in the StatefulSet. Each pod is a separate store; see "Connect engines" before raising it. Must be 1 with S3 enabled.

  • image.repository, image.tagdefault: set by you

    Where the kvblockd image is pulled from. The tag defaults to the chart's app version (0.2.0 in the current chart); set it to the daemon version you run.

  • imagePullSecretsdefault: []

    For a private registry.

  • service.typedefault: ClusterIP

    Keep the data port inside the cluster.

  • service.dataPort, service.metricsPortdefault: 9440, 9442

    Data plane and /metrics, /healthz.

  • serviceAccount.annotationsdefault: {}

    IRSA role for the S3 tier on EKS.

  • config.dramArenaBytesdefault: 1073741824

    Hot tier size in bytes (1 GiB).

  • config.dramHugepagesdefault: false

    Map the arena on 2 MiB hugepages. Requires hugepages.enabled.

  • config.extradefault: {}

    Any other daemon config key, written into the config file as is (eviction, socket buffers, limits).

  • namespaces.entriesdefault: none, required

    Tenants, rendered into a Secret. The chart refuses to render with no entries and no existingSecret.

  • namespaces.existingSecretdefault: unset

    Use your own Secret with a namespaces.yaml key instead; wins over entries.

  • persistence.enableddefault: false

    Adds a volume per pod at /var/lib/kvblockd/nvme and turns on the NVMe tier.

  • persistence.size, persistence.maxBytesdefault: 100Gi, 0

    Volume size and the daemon's NVMe budget. maxBytes is required when enabled and must fit in the volume.

  • persistence.storageClassNamedefault: cluster default

    Pick a local-NVMe class; network disks change the performance picture.

  • s3.enabled, s3.bucket, s3.regiondefault: false

    Cold tier. Requires persistence.

  • s3.nodeIddefault: release name

    Prefix for this daemon's objects. Unique per daemon.

  • s3.endpointOverride, s3.pathStyledefault: unset, false

    For MinIO and other S3-compatible stores.

  • s3compat.enabled, s3compat.portdefault: false, 9500

    S3-compatible listener for NIXL object clients. Not GPU-tested.

  • hugepages.enabled, hugepages.countdefault: false, 512

    Request hugepages-2Mi. count x 2 MiB must cover the arena.

  • resourcesdefault: 1 CPU, 2Gi

    Memory limit must exceed the arena when hugepages are off.

  • extraEnvdefault: []

    Extra environment variables, such as KVBLOCKD_MAX_CONNS or AWS_REGION.

  • terminationGracePeriodSecondsdefault: 30

    Time for the graceful drain on SIGTERM.

  • nodeSelector, tolerations, affinity, priorityClassNamedefault: unset

    Standard scheduling controls.

Something missing or wrong on this page? Email rudray@kvstash.com and it gets fixed.