---
title: "Admission webhook"
description: "Installing TRUSTIVAN's validating admission webhook with the Helm chart: fail-closed by default, the exempt namespaces, and the documented opt-out."
---

The chart in `infra/helm/trustivan-admission` registers a
`ValidatingWebhookConfiguration` that sends every Pod, Deployment, StatefulSet,
DaemonSet, ReplicaSet, Job and CronJob create or update in your cluster to
TRUSTIVAN for a decision. What TRUSTIVAN decides, and what `mode` (`audit`,
`warn`, `deny`) does, is in [Cloud and Kubernetes](/configuration/cloud-and-kubernetes#admission-control).

## Why there is a relay

An API server can only send its webhook a client credential through its own
control-plane configuration, which you cannot change on EKS, GKE or AKS. So the
chart runs a small relay (nginx, two replicas) inside the cluster: the webhook
calls the relay over TLS with a certificate the chart generates, and the relay
forwards the review to TRUSTIVAN with your API key in the `Authorization`
header. The relay runs as a non-root user with a read-only root filesystem, all
capabilities dropped, the `RuntimeDefault` seccomp profile and no service
account token.

## Install

1. Connect the cluster and note its `id`, then enable admission control on it
   (the **Admission control** dialog, or `PUT /api/v1/kubernetes/clusters/{id}/admission`).
2. Create a TRUSTIVAN API key holding `scans:create`.
3. Install the chart:

```bash
helm install trustivan-admission infra/helm/trustivan-admission \
  --namespace trustivan-admission --create-namespace \
  --set clusterId=<cluster id> \
  --set trustivan.existingSecret=<secret with key "token">
```

`trustivan.token=<key>` works instead of `existingSecret`, but puts the key in
your Helm values. `trustivan.url` defaults to `https://app.trustivan.com`; a
self-hosted deployment sets its own, which must be `https` with a certificate the
relay's system trust store accepts.

## Failing closed, and the opt-out

| Value | Default | What happens when TRUSTIVAN or the relay cannot answer |
|---|---|---|
| `failurePolicy: Fail` | **yes** | The API server **refuses** the request. |
| `failurePolicy: Ignore` | | The API server admits it. |

Fail is the default because an admission control that admits whatever arrives
while it is unreachable is no control during exactly that window. Two
namespaces are never sent to TRUSTIVAN, so the cluster stays repairable during
an outage: `kube-system`, and the namespace the chart is installed in (the relay
itself). Add more with `exemptNamespaces`.

The cost is real: with Fail, a TRUSTIVAN outage stops deployments in every other
namespace until it is over. If availability matters more to a cluster, opt out:
set `failurePolicy=Ignore` in the chart **and** `failure_mode: "open"` on the
cluster, so that both the API server (when the relay cannot be reached) and
TRUSTIVAN (when it cannot adjudicate) admit, and every such admission is recorded.

A newly connected cluster's `failure_mode` is `closed` to match. Clusters
connected before this default changed keep the mode they had.

## What has been tested

`backend/internal/e2e/admission_webhook_e2e_test.go`, run by
`scripts/dev/k3d-validate.sh`, installs this chart into a local **k3d** cluster
(k3s v1.30.6) with TRUSTIVAN deliberately unreachable, and checks that the relay
starts under its security context, that a pod in an ordinary namespace is
refused with `failurePolicy: Fail`, that `kube-system` and the chart's namespace
are admitted, and that `failurePolicy: Ignore` admits the same pod.

Not tested: a review travelling through the relay to a live TRUSTIVAN and back
(that needs a TRUSTIVAN reachable from the cluster with a publicly trusted
certificate), and any managed distribution (EKS, GKE, AKS).
