clamav-operator

by SolucTeam

Helm chartv0.10.0App 0.10.0Apache-2.0Verified publisher

Kubernetes Operator for ClamAV antivirus scanning on cluster nodes. Supports standalone (embedded binary) and remote (clamd) scan modes, incremental/smart scanning strategies, multi-CRD lifecycle management, Prometheus metrics, and Slack/Email/Webhook notifications.

About this chart

ClamAV Operator Helm Chart

Helm chart for deploying the ClamAV Operator — a Kubernetes operator for cluster-wide antivirus scanning using ClamAV. Supports standalone (embedded signatures) and remote clamd modes, incremental scanning, Prometheus monitoring, and scheduled scans.

CRDs Installed

CRDDescription
nodescans.clamav.ioScan a single node
clusterscans.clamav.ioScan all (or selected) nodes
scanpolicies.clamav.ioReusable scan configuration
scanschedules.clamav.ioCron-based scheduled scanning
scancacheresources.clamav.ioIncremental scan state cache

Prerequisites

  • Kubernetes 1.24+
  • Helm 3.0+
  • No external ClamAV service required (standalone mode is the default)
  • cert-manager (optional, but strongly recommended for production webhook TLS — see Webhook TLS)

Installation

Install from local sources

# Create namespace and install (standalone mode by default)
helm install clamav-operator ./helm/clamav-operator \
  --namespace clamav-system \
  --create-namespace

# Install with custom values
helm install clamav-operator ./helm/clamav-operator \
  --namespace clamav-system \
  --create-namespace \
  --values my-values.yaml

# Install with inline parameters
helm install clamav-operator ./helm/clamav-operator \
  --namespace clamav-system \
  --create-namespace \
  --set scanner.mode=standalone \
  --set scanner.freshclam.enabled=true

Configuration

Operator Parameters

ParameterDescriptionDefault
operator.replicaCountNumber of operator replicas1
operator.image.repositoryOperator image repositoryghcr.io/solucteam/clamav-operator
operator.image.tagOperator image tag"" (chart version)
operator.resources.limits.cpuOperator CPU limit500m
operator.resources.limits.memoryOperator memory limit256Mi

Scanner Parameters

ParameterDescriptionDefault
scanner.image.repositoryScanner image repositoryghcr.io/solucteam/clamav-node-scanner
scanner.image.tagScanner image tag"" (chart appVersion)
scanner.modeScan mode: standalone or remotestandalone
scanner.resources.requests.cpuScanner CPU request500m
scanner.resources.requests.memoryScanner memory request512Mi
scanner.resources.limits.cpuScanner CPU limit2000m
scanner.resources.limits.memoryScanner memory limit1Gi

Scanner Standalone Parameters

ParameterDescriptionDefault
scanner.standalone.clamscanPathPath to clamscan binary/usr/bin/clamscan
scanner.standalone.clamavDbPathPath to signature database/var/lib/clamav

Scanner Remote Parameters (Legacy)

ParameterDescriptionDefault
scanner.clamav.hostClamAV service hostclamav.clamav.svc.cluster.local
scanner.clamav.portClamAV service port3310

Freshclam Parameters

ParameterDescriptionDefault
scanner.freshclam.enabledEnable the freshclam signature-update CronJobtrue
scanner.freshclam.scheduleCron schedule for updates0 */6 * * *
scanner.freshclam.image.repositoryFreshclam imageclamav/clamav
scanner.freshclam.image.tagFreshclam image tag1.3
scanner.freshclam.resources.limits.cpuFreshclam CPU limit500m
scanner.freshclam.resources.limits.memoryFreshclam memory limit256Mi

Standalone mode limitation: In standalone mode, the freshclam CronJob writes signatures to its own volume (emptyDir or PVC). Scanner job pods do not mount that volume — they read signatures from CLAMAV_DB_PATH inside the scanner container image. Enabling freshclam therefore has no effect on what scanner jobs scan with in standalone mode. Signatures must be baked into the scanner image at build time. The freshclam CronJob is only effective in remote mode, where it shares a PVC with the running clamd daemon.

Signature Persistence Parameters

ParameterDescriptionDefault
scanner.signatures.persistentUse a PVC for signaturesfalse
scanner.signatures.pvcNamePVC nameclamav-signatures
scanner.signatures.storageClassStorageClass (empty = default)""
scanner.signatures.accessModePVC access mode. Use ReadWriteMany for multi-node signature sharing (requires NFS/CephFS/EFS/…). ReadWriteOnce only works if all scanner pods land on the same node as freshclam.ReadWriteOnce
scanner.signatures.sizePVC size1Gi

ReadWriteMany is required when signatures.persistent=true. Scanner jobs run on different nodes; a ReadWriteOnce PVC can only be mounted by pods on the single node where it is bound — all other scanner pods fail with "Multi-Attach error". RWX requires a storage backend that supports it: NFS, CephFS, Azure Files, AWS EFS, GCP Filestore. Standard block storage (EBS, GCP Persistent Disk) does not support RWX — use the image-embedded approach instead (persistent: false).

Registry Signature Parameters

ParameterDescriptionDefault
scanner.signature.sourceSignature delivery: image (baked-in, default) or registry (pull CVDs at boot)image
scanner.signature.registryURLRegistry v2 base URL (e.g. Harbor)""
scanner.signature.refsComma-separated artifact refs (Harbor project included)""
scanner.signature.existingSecretSecret with registry credentials (keys username/password)""
scanner.signature.caSecret.nameSecret holding the registry TLS CA bundle (private CA). Scanner Job pods mount it and receive NODE_EXTRA_CA_CERTS.""
scanner.signature.caSecret.keySecret data key holding the PEM bundleca.crt

Private CA: when the registry certificate is signed by a private CA (e.g. internal Harbor), set caSecret.name to a Secret containing the PEM bundle. Scanner Job pods mount it and get NODE_EXTRA_CA_CERTS pointing at the mounted file — Node's fetch (undici) trusts the private CA natively, no scanner-side change needed. The image-baked signatures remain the automatic fallback if the pull fails.

Incremental Scan Parameters

ParameterDescriptionDefault
scanner.incremental.enabledEnable incremental scanningtrue
scanner.incremental.strategyStrategy: full, incremental, smartsmart
scanner.incremental.fullScanIntervalFull scan every N incremental runs (smart)10
scanner.incremental.maxFileAgeHoursMax file age for incremental scans24
scanner.incremental.skipUnchangedFilesSkip files with same mtime+sizetrue

Automatic cache invalidation on signature update (v3 cache format): The scanner computes a fingerprint of all .cvd/.cld files in CLAMAV_DB_PATH (mtime + size). This fingerprint is stored with the cache. If signatures have been updated since the last scan, the fingerprint differs and the incremental cache is automatically discarded — forcing a full scan on the next run. This guarantees that every file is re-evaluated against the new signatures, even files whose content and metadata are unchanged. No manual cache deletion is required after a freshclam update.

Webhook & TLS Parameters

ParameterDescriptionDefault
webhook.enabledEnable admission + conversion webhookstrue
webhook.portWebhook server port (synced to --webhook-port flag and Service)9443
webhook.certManager.enabledUse cert-manager to manage webhook TLStrue
webhook.certificates.autoGenerateAuto-generate self-signed certs (dev only, not rotated)true
webhook.certificates.caBundleBase64-encoded CA bundle for manual TLS""

cert-manager is enabled by default. From v0.5.0, webhook.certManager.enabled defaults to true. Install cert-manager before deploying the operator, or explicitly set webhook.certManager.enabled: false to fall back to auto-generated self-signed certs (not automatically rotated — not recommended for production).

When webhook.certManager.enabled: true the chart creates a full self-signed CA chain (SelfSigned Issuer → CA Certificate → CA Issuer → leaf Certificate). The ValidatingWebhookConfiguration is annotated with cert-manager.io/inject-ca-from so cert-manager's cainjector populates caBundle automatically.

A Helm post-install/post-upgrade hook Job patches the three CRDs (nodescans, clusterscans, scanschedules) with conversion.strategy: Webhook so the /convert endpoint is correctly wired.

CRD Patcher Hook Parameters

ParameterDescriptionDefault
crdPatcher.image.repositorykubectl image used by the post-install hook Jobregistry.k8s.io/kubectl
crdPatcher.image.tagImage tag — pin to your cluster minor version"1.29"
crdPatcher.image.pullPolicyImage pull policyIfNotPresent
crdPatcher.imagePullSecretsPull secrets for the hook Job (air-gap / private registry)[]
# Air-gap example
crdPatcher:
  image:
    repository: my-registry.internal/kubectl
    tag: "1.30"
  imagePullSecrets:
    - name: regcred

Scanner Image Pull Secrets

ParameterDescriptionDefault
scanner.imagePullSecretsPull secrets injected into every scanner Job pod[]
# Private registry example
scanner:
  imagePullSecrets:
    - name: regcred

These secrets are forwarded from the operator pod environment (SCANNER_IMAGE_PULL_SECRETS) into the imagePullSecrets field of each Job's pod spec.

Network Policy Parameters

ParameterDescriptionDefault
networkPolicy.enabledEnable NetworkPolicy resourcestrue
networkPolicy.controlPlaneCIDRCIDR of the Kubernetes API server / control-plane nodes. Used for egress to the API server and ingress from the API server to the webhook port. Set to your actual control-plane CIDR in production."0.0.0.0/0"
networkPolicy.apiServerPortAPI server port. Standard clusters use 6443; some managed clusters (AKS, GKE) expose it on 443.6443
networkPolicy.nodesCIDRCIDR of cluster nodes. Kubelet liveness/readiness probes originate from node IPs — a namespaceSelector cannot match them. Set to your node subnet in production."0.0.0.0/0"
networkPolicy.ingressAdditional ingress rules (e.g. Prometheus scrape). Kubelet probe and webhook rules are generated automatically.[]
networkPolicy.egressAdditional egress rules for the operator pod (ClamAV, DNS, …). API server egress is generated automatically.[]
networkPolicy.freshclamEgressEgress rules for the freshclam CronJob pod. Only rendered when scanner.mode=standalone and scanner.freshclam.enabled=true.[]

Why ipBlock and not namespaceSelector? The Kubernetes API server and the kubelet both run as host processes on nodes, not as pods. namespaceSelector only matches pod-to-pod traffic; it has no effect on traffic that originates outside the pod network. Without ipBlock rules, the operator pod cannot reach the API server (startup checks fail with i/o timeout) and kubelet probes are silently dropped (liveness/readiness never pass).

# Production example — restrict to actual CIDRs
networkPolicy:
  enabled: true
  controlPlaneCIDR: "10.0.0.10/32"   # exact API server IP
  apiServerPort: 6443
  nodesCIDR: "10.0.1.0/24"           # worker node subnet

Default Scan Schedule Parameters

Disabled by default. Enable to automatically run cluster-wide scans on a cron schedule without creating resources manually.

ParameterDescriptionDefault
defaultScanSchedule.enabledCreate a default ScanSchedule resourcefalse
defaultScanSchedule.nameScanSchedule resource namedefault-schedule
defaultScanSchedule.scheduleCron expression0 2 * * * (daily at 02:00)
defaultScanSchedule.suspendPause scheduled runs without deleting the resourcefalse
defaultScanSchedule.concurrencyPolicyForbid / Allow / ReplaceForbid
defaultScanSchedule.scanPolicyScanPolicy to usedefault-policy
defaultScanSchedule.concurrentMax nodes scanned in parallel3
defaultScanSchedule.priorityNodeScan priority: high / medium / lowlow
defaultScanSchedule.nodeSelectorRestrict to specific nodes (empty = all nodes){}
defaultScanSchedule.successfulScansHistoryLimitSuccessful ClusterScans to retain3
defaultScanSchedule.failedScansHistoryLimitFailed ClusterScans to retain1
defaultScanSchedule.startingDeadlineSecondsMax delay (s) before skipping a missed run""
# Enable automatic nightly scans on worker nodes only
defaultScanSchedule:
  enabled: true
  schedule: "0 2 * * *"
  concurrent: 3
  priority: low
  nodeSelector:
    matchLabels:
      node-role.kubernetes.io/worker: ""

Other Parameters

ParameterDescriptionDefault
crds.installInsta

Deploy clamav-operator with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has clamav-operator 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 chartclamav-operator is pinned at v0.10.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