Docs / Kubernetes admission

Kubernetes admission

A validating webhook in front of your GPU workloads. When a Deployment, Job, JobSet, PyTorchJob, RayJob, LeaderWorkerSet or bare Pod that asks for GPUs is created, it reads the serving launch (vllm serve, SGLang, llama-server) or the training split, reads the model's config.json from a ConfigMap in your cluster, and warns on, or refuses, the ones that cannot start. Before Kueue admits them and before a GPU is taken.

Fifteen minutes, five steps. It starts in audit mode with failurePolicy: Ignore: nothing is refused, and a webhook that is down admits everything. Nothing leaves the cluster unless you turn the Hub fallback on. What it sends: trust page.

1. Install

Kubernetes 1.30 or later (webhook match conditions are GA there), Helm 3, and rights to create a ValidatingWebhookConfiguration.

$ helm install neurarch-admission oci://ghcr.io/neurarch-ai/charts/neurarch-admission \
    --version 0.1.0 -n neurarch --create-namespace
$ kubectl -n neurarch logs deploy/neurarch-admission | grep admission:
[selfhost] admission: mode AUDIT, model cache /models, Hub fetch off

Two replicas with a PodDisruptionBudget, non-root, read-only root filesystem, no service account token, and a NetworkPolicy that allows ingress on the HTTPS port and no egress at all. If helm install answers "not found", the first release of the chart has not been published yet: write to neurarch.ai@gmail.com.

2. Give it your models

The check reads each model's config.json, generation_config.json, tokenizer_config.json and chat template. Never the weights. The chart carries a script that fetches them where the Hub is reachable and writes them as values:

$ helm pull oci://ghcr.io/neurarch-ai/charts/neurarch-admission --version 0.1.0 --untar
$ bash neurarch-admission/files/cache-model.sh --helm-values \
    Qwen/Qwen2.5-7B-Instruct meta-llama/Llama-3.1-8B-Instruct > models.values.yaml
$ helm upgrade neurarch-admission oci://ghcr.io/neurarch-ai/charts/neurarch-admission \
    --version 0.1.0 -n neurarch --reuse-values -f models.values.yaml

Set HF_TOKEN for gated repositories; pin a revision with org/name@<sha>. A model that is not in the cache is admitted with "not cached" in its audit annotation. It is never judged by a guess.

3. See an audit warning

Opt a namespace in, then create a launch that cannot load: tensor parallel 8 does not divide Qwen2.5-7B's 28 attention heads.

$ kubectl label namespace inference neurarch.com/precheck=enabled
$ cat > qwen-serve.yaml <<'EOF'
apiVersion: apps/v1
kind: Deployment
metadata: { name: qwen-serve }
spec:
  replicas: 1
  selector: { matchLabels: { app: qwen-serve } }
  template:
    metadata: { labels: { app: qwen-serve } }
    spec:
      nodeSelector: { nvidia.com/gpu.product: NVIDIA-L4 }
      containers:
        - name: vllm
          image: vllm/vllm-openai:latest
          command: [vllm, serve, Qwen/Qwen2.5-7B-Instruct, --tensor-parallel-size, "8"]
          resources: { limits: { nvidia.com/gpu: 8 } }
EOF
$ kubectl -n inference apply -f qwen-serve.yaml
Warning: Neurarch would refuse (audit mode): vllm in spec.template (Qwen/Qwen2.5-7B-Instruct,
8 x l4 per replica): TP 8 does not divide 28 attention heads. Use a TP size that passes every
TP rule for this model: 1, 2, 4.
Warning: Neurarch: vllm in spec.template (Qwen/Qwen2.5-7B-Instruct, 8 x l4 per replica): TP 8 is
past 4 KV heads: each KV head is replicated 2x. TP 4 with DP 2 serves more sequences on the same
GPUs, if the weights fit at TP 4.
deployment.apps/qwen-serve created

The same verdict lands in the API server's audit log as annotations on the request (workloads.precheck.neurarch.com/verdict: refuse, .../mode: audit, .../blockers). Search for those before turning enforcement on. The same Deployment with --tensor-parallel-size 4 and 4 GPUs comes back with no warning.

4. Switch to enforce

$ kubectl -n inference delete -f qwen-serve.yaml
$ helm upgrade neurarch-admission oci://ghcr.io/neurarch-ai/charts/neurarch-admission \
    --version 0.1.0 -n neurarch --reuse-values --set mode=enforce
$ kubectl -n inference apply -f qwen-serve.yaml
Error from server (Forbidden): admission webhook "workloads.precheck.neurarch.com" denied the
request: Neurarch refused this workload before it took a GPU: vllm in spec.template
(Qwen/Qwen2.5-7B-Instruct, 8 x l4 per replica): TP 8 does not divide 28 attention heads. Use a TP
size that passes every TP rule for this model: 1, 2, 4. Predicted from config.json and the launch
flags, not measured. Annotate neurarch.com/skip=true to bypass.

Enforce refuses only the blockers a launch cannot survive: tensor parallel not dividing the heads, KV heads or FFN; a world size that does not match the GPUs; a served length the KV cache cannot hold for one request; weights over the card; an unsupported or mismatched quantization. Everything else stays a warning. failurePolicy stays Ignore, so a webhook that cannot answer still admits; webhook.failurePolicy=Fail exists, and makes an outage of this pod an outage of GPU scheduling in every selected namespace.

5. Read the ledger

$ helm upgrade neurarch-admission oci://ghcr.io/neurarch-ai/charts/neurarch-admission \
    --version 0.1.0 -n neurarch --reuse-values --set ledger.enabled=true
$ kubectl -n neurarch port-forward svc/neurarch-admission 8443:443 &
$ curl -sk https://localhost:8443/v1/ledger | jq '.summary.sentences, .rows[-1]'
[
  "4 admission decisions recorded for 2 workloads; 0 outcomes posted, 0 joined to a decision.",
  "Refused or would have refused, then reported: 0 failed, 0 ran cleanly.",
  ...
]
{
  "kind": "admission",
  "workload": { "namespace": "inference", "kind": "Deployment", "name": "qwen-serve", "operation": "CREATE" },
  "mode": "audit", "verdict": "refuse", "refused": false,
  "rules": ["tp-heads", "tp-kv-replicated"],
  "containers": [{ "model": "Qwen/Qwen2.5-7B-Instruct", "revision": null, "pinned": false,
                   "engine": "vllm", "image": "vllm/vllm-openai:latest", "gpu": "l4", "gpus": 8,
                   "predicted": { "check": "serve", "kv_tokens": 1286576, "max_concurrency": 39.26, ... } }]
}

One JSON line per decision on a PersistentVolumeClaim the chart keeps on helm uninstall. Post how a workload ended to POST /v1/outcome ({"workload": {"namespace", "name"}, "result": "completed" | "oom" | "failed"}) and the summary counts, for each verdict, how many failed and how many ran cleanly: in audit mode, that is how you learn whether the refusals were right before you enforce them. With a ReadWriteOnce volume (the default) the chart runs one replica, because one file has one writer. To require a token on /v1/*, set selfhostToken.existingSecret; /admission is never behind it, because the API server cannot send one.

Values

ValueDefaultDoes
modeauditenforce refuses the blockers above.
webhook.failurePolicyIgnoreFail blocks GPU workloads whenever the webhook is unreachable.
webhook.timeoutSeconds51 to 30.
webhook.namespaceSelectorneurarch.com/precheck: enabledWhich namespaces are checked.
webhook.objectSelector{}Which objects, by label.
modelCache.files{}Model config files, as cache-model.sh --helm-values writes them.
allowHubFetchfalsetrue reads a missing model's config from huggingface.co (the model id leaves the cluster, nothing else) and opens egress to TCP 443 and DNS.
ledger.enabledfalseEvery decision appended to a file on a volume.
networkPolicy.enabledtrueIngress on 8443 only, no egress.
tls.modeautoSee below.

The chart refuses to render a mode or policy outside these, tls.mode=certManager without cert-manager, or existingSecret without its CA: a webhook the API server cannot verify would, under Ignore, admit everything in silence.

TLS, with or without cert-manager

With cert-manager (used automatically when cert-manager.io/v1 is served): a Certificate for the Service name from a self-signed Issuer the chart creates, or from yours (tls.certManager.issuerRef). cainjector writes the CA into the webhook.

Without it: two Helm hook Jobs running kube-webhook-certgen, the tool the ingress-nginx chart uses. Before install, one makes a CA and a serving certificate and stores them in a Secret; after install, the other writes the CA into the webhook. Upgrades read the CA back from the Secret, so the webhook is never left without one.

Your own: tls.mode=existingSecret, tls.existingSecret (a kubernetes.io/tls Secret) and tls.caBundle.

The verifier re-reads its certificate every minute and swaps a renewed one in without a restart.

How this was checked, 2026-11-29: helm lint and helm template (Helm 3.16.4) on the defaults and on each toggle above, and the rendered manifests validated against the Kubernetes 1.30 schemas. The outputs in steps 3 to 5 are the verifier's own AdmissionReview answers and ledger, captured by running it with the chart's environment and the published Qwen2.5-7B-Instruct config files; the Warning: and Error from server lines are how kubectl prints those answers. The same steps run on a kind cluster on every change to the chart.