clair

by hackertwinten

Helm chartv0.12.0App 4.9.0Apache-2.0Verified publisher

Helm chart for Clair — container vulnerability static analysis tool (Quay/Red Hat)

About this chart

clair-helm

Helm chart for deploying Clair — the open-source container vulnerability static analysis tool by Red Hat/Quay.

Supports two deployment modes:

  • combo (default) — single all-in-one Clair process running indexer + matcher, with an optional separate notifier pod
  • distributed — separate Deployment per component (indexer, matcher, notifier) with path-based Ingress routing

Contents

  • Prerequisites
  • Installation
  • Deployment modes
  • Configuration
  • Values reference
  • Upgrading
  • Uninstalling

Prerequisites

  • Kubernetes 1.24+
  • Helm 3.10+
  • kubectl configured against your cluster
  • For distributed mode: a Layer 7 Ingress controller (nginx, traefik, etc.)

Installation

From the Helm repository (recommended)

helm repo add clair-helm https://hackertwinten.github.io/clair-helm
helm repo update
helm install clair clair-helm/clair -n clair --create-namespace

From source

git clone https://github.com/hackertwinten/clair-helm.git
cd clair-helm
helm install clair . -n clair --create-namespace

Verify the release:

helm status clair -n clair
kubectl get pods -n clair

Run the health check tests:

helm test clair -n clair

Port-forward to access the API locally (combo mode):

kubectl port-forward -n clair svc/clair 6060:6060
curl http://localhost:6060/api/v1/index_report

Deployment modes

Combo mode (default)

Runs all Clair components in a single process (CLAIR_MODE=combo). An optional second pod can handle notifications independently.

helm install clair ./clair-helm -n clair --create-namespace

Resources created:

ResourceDescription
Deployment/clairClair main process in combo mode
Deployment/clair-notifierDedicated notifier pod (combo.notifier.enabled=true)
Deployment/clair-postgresqlBundled PostgreSQL 15
Service/clairClusterIP on port 6060 and 8089
Service/clair-notifierClusterIP for the notifier
Service/clair-postgresqlClusterIP for Postgres
Secret/clair-dbDatabase password (auto-generated)
Secret/clair-configClair config YAML
PersistentVolumeClaim/clair-postgresql10Gi data volume

Distributed mode

Runs each Clair component as its own Deployment. Requires a Layer 7 Ingress controller to route requests by path.

helm install clair ./clair-helm -n clair --create-namespace \
  --set mode=distributed \
  --set distributed.ingress.enabled=true \
  --set distributed.ingress.className=nginx \
  --set distributed.ingress.host=clair.example.com

Resources created:

ResourceDescription
Deployment/clair-indexerIndexer component
Deployment/clair-matcherMatcher component
Deployment/clair-notifierNotifier component (if enabled)
Service/clair-indexerClusterIP for indexer
Service/clair-matcherClusterIP for matcher
Service/clair-notifierClusterIP for notifier
Ingress/clairRoutes /indexer, /matcher, /notifier to each service
Deployment/clair-postgresqlBundled PostgreSQL 15
Secret/clair-configShared Clair config YAML

The Ingress routes traffic by path prefix:

  • clair.example.com/indexer/* → indexer
  • clair.example.com/matcher/* → matcher
  • clair.example.com/notifier/* → notifier

Configuration

All options are in values.yaml. Common overrides:

Use an external PostgreSQL database

helm install clair ./clair-helm -n clair --create-namespace \
  --set postgresql.enabled=false \
  --set database.externalConnString="host=mydb.example.com port=5432 dbname=clair user=clair password=s3cr3t sslmode=require"

Set a specific database password

By default the chart generates a random 32-character password on first install and reuses it on upgrades. To set your own:

helm install clair ./clair-helm -n clair --create-namespace \
  --set database.password=mysecretpassword

Disable the notifier

# Combo mode
helm install clair ./clair-helm -n clair --create-namespace \
  --set combo.notifier.enabled=false

# Distributed mode
helm install clair ./clair-helm -n clair --create-namespace \
  --set mode=distributed \
  --set distributed.notifier.enabled=false

Enable Ingress (combo mode)

helm install clair ./clair-helm -n clair --create-namespace \
  --set combo.ingress.enabled=true \
  --set combo.ingress.className=nginx \
  --set "combo.ingress.hosts[0].host=clair.example.com" \
  --set "combo.ingress.hosts[0].paths[0].path=/" \
  --set "combo.ingress.hosts[0].paths[0].pathType=Prefix"

Enable HPA (combo mode)

helm install clair ./clair-helm -n clair --create-namespace \
  --set combo.autoscaling.enabled=true \
  --set combo.autoscaling.minReplicas=2 \
  --set combo.autoscaling.maxReplicas=5

Enable per-component HPA (distributed mode)

helm install clair ./clair-helm -n clair --create-namespace \
  --set mode=distributed \
  --set distributed.indexer.autoscaling.enabled=true \
  --set distributed.indexer.autoscaling.maxReplicas=10 \
  --set distributed.matcher.autoscaling.enabled=true \
  --set distributed.matcher.autoscaling.maxReplicas=10

Set resource limits

# custom-values.yaml
combo:
  resources:
    requests:
      cpu: 200m
      memory: 512Mi
    limits:
      cpu: 1000m
      memory: 1Gi

postgresql:
  resources:
    requests:
      cpu: 100m
      memory: 256Mi
    limits:
      cpu: 500m
      memory: 512Mi

Configure webhook notifications

# custom-values.yaml
config:
  notifier:
    webhook:
      target: "https://my-webhook.example.com/clair"
      callback: "http://clair:6060/notifier/api/v1/notifications"
      signed: false

Values reference

Global

KeyDefaultDescription
modecomboDeployment mode: combo or distributed
nameOverride""Override the chart name
fullnameOverride""Override the full release name
image.repositoryquay.io/projectquay/clairClair image
image.tag4.9.0Image tag (defaults to appVersion)
config.logLevelinfoLog level: debug, info, warn, error
config.indexer.migrationstrueRun DB migrations on startup
config.matcher.period6hHow often to sync vulnerability data
config.matcher.disableUpdatersfalseDisable vulnerability feed updates

Database

KeyDefaultDescription
database.externalConnString""Full PostgreSQL DSN (disables bundled Postgres)
database.nameclairDatabase name
database.userclairDatabase user
database.password""Password (auto-generated if empty)

PostgreSQL (bundled)

KeyDefaultDescription
postgresql.enabledtrueDeploy bundled PostgreSQL
postgresql.image.tag17-alpinePostgreSQL image tag
postgresql.persistence.enabledtrueEnable PVC
postgresql.persistence.existingClaim""Use a pre-existing PVC instead of creating one
postgresql.persistence.size10GiPVC size (ignored when existingClaim is set)
postgresql.persistence.storageClass""Storage class (cluster default if empty)

Combo mode

KeyDefaultDescription
combo.replicaCount1Number of Clair replicas
combo.service.typeClusterIPService type
combo.service.port6060HTTP API port
combo.ingress.enabledfalseEnable Ingress
combo.autoscaling.enabledfalseEnable HPA
combo.pdb.enabledfalseEnable PodDisruptionBudget
combo.notifier.enabledtrueDeploy a dedicated notifier pod
combo.notifier.replicaCount1Notifier replicas

Distributed mode

KeyDefaultDescription
distributed.ingress.enabledtrueEnable path-based Ingress (required for external access)
distributed.ingress.hostclair.example.comIngress hostname
distributed.ingress.className""Ingress class name
distributed.indexer.replicaCount2Indexer replicas
distributed.indexer.autoscaling.enabledfalseEnable HPA for indexer
distributed.matcher.replicaCount2Matcher replicas
distributed.matcher.autoscaling.enabledfalseEnable HPA for matcher
distributed.notifier.enabledtrueDeploy notifier
distributed.notifier.replicaCount1Notifier replicas

Security

All pods run with:

  • runAsNonRoot: true
  • allowPrivilegeEscalation: false
  • readOnlyRootFilesystem: true
  • All Linux capabilities dropped

The Clair config (which contains the database password) is stored in a Kubernetes Secret, not a ConfigMap. Pods automatically restart when the config secret changes via a checksum annotation.


Upgrading

helm upgrade clair ./clair-helm -n clair

The database password is preserved across upgrades — the chart uses lookup to read the existing Secret and reuses the same password rather than generating a new one.


Uninstalling

helm uninstall clair -n clair

The PostgreSQL PVC is retained by default Kubernetes behavior. Delete it manually to free storage:

kubectl delete pvc clair-postgresql -n clair

Deploy clair with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has clair on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartclair is pinned at v0.12.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply