Skip to main content
Version: Next
Enterprise

Compliance Management

Knodex Enterprise integrates with OPA Gatekeeper to provide a compliance dashboard for viewing and managing policy enforcement across your cluster.

Overview

The compliance dashboard surfaces Gatekeeper resources directly in the Knodex UI:

  • ConstraintTemplates -- Define policy logic using Rego
  • Constraints -- Instantiate templates with parameters and match rules
  • Violations -- Track resources that violate active constraints

Prerequisites

  • Knodex Enterprise license with the compliance feature
  • OPA Gatekeeper installed in the cluster
  • Knodex server ServiceAccount with read access to Gatekeeper CRDs

Viewing Compliance Status

Dashboard

Navigate to Compliance in the Knodex sidebar. The dashboard shows a summary of your compliance posture.

Summary Statistics

MetricDescription
Total TemplatesNumber of ConstraintTemplates in the cluster
Total ConstraintsNumber of active Constraints across all templates
Total ViolationsNumber of resources currently in violation
Enforcement RatePercentage of constraints in deny mode vs dryrun or warn

Constraint Templates

Viewing Templates

The Templates tab lists all ConstraintTemplates with their metadata, constraint count, and violation summary.

Template Details

FieldDescription
NameConstraintTemplate resource name
KindThe constraint kind this template creates (e.g., K8sRequiredLabels)
DescriptionFrom the knodex.io/compliance annotation or template metadata
ParametersSchema of parameters accepted by constraints
Constraint CountNumber of constraints created from this template
Total ViolationsAggregate violations across all constraints of this kind

Managing Constraints

Viewing Constraints

The Constraints tab lists all constraints with their template kind, enforcement action, match rules, and violation count.

Constraint Details

FieldDescription
NameConstraint resource name
KindThe ConstraintTemplate kind (e.g., K8sRequiredLabels)
Enforcement Actiondeny, dryrun, or warn
Match RulesKinds, namespaces, and label selectors the constraint applies to
ParametersTemplate-specific parameters
ViolationsResources currently violating this constraint

Changing Enforcement Actions

Knodex allows changing the enforcement action on existing constraints without editing YAML.

Enforcement Action Types

ActionBehavior
denyBlock non-compliant resources from being created or updated
dryrunRecord violations without blocking. Resources are created normally.
warnAllow creation but return a warning to the user

Updating Enforcement

  1. Navigate to the constraint detail page
  2. Click the enforcement action badge
  3. Select the new enforcement action from the dropdown
  4. Confirm the change
Cluster Impact

Changing enforcement from dryrun to deny immediately blocks non-compliant resources. Test with warn first to understand the impact.

Rollout Strategy

A safe rollout for new constraints follows this progression:

  1. Deploy the constraint with dryrun to discover existing violations
  2. Move to warn to alert users without blocking
  3. After violations are resolved, switch to deny for full enforcement

Viewing Violations

Violation List

The Violations tab shows all current violations across the cluster, filterable by constraint kind, namespace, and resource type.

Violation Details

FieldDescription
ResourceThe violating resource (Kind, name, namespace)
ConstraintThe constraint that was violated
Template KindThe ConstraintTemplate kind
MessageHuman-readable violation message from the Rego policy
Enforcement ActionWhether this violation is blocking (deny) or informational (dryrun/warn)

Resolving Violations

Violations are resolved by either:

  1. Fixing the resource -- Update the resource to comply with the constraint
  2. Updating the constraint -- Modify match rules or parameters to exclude the resource
  3. Changing enforcement -- Switch to dryrun if the constraint is too restrictive

Violations are cleared automatically when the resource is updated or deleted. Gatekeeper re-evaluates on resource changes.

Required Permissions

Casbin Permissions

Users need the following Casbin policies to access compliance features:

ActionPolicy
View compliance dashboardcompliance/*, get, allow
Change enforcement actioncompliance/*, update, allow

Kubernetes Permissions

The Knodex server ServiceAccount needs these cluster-level permissions:

ResourceAPI GroupVerbs
constrainttemplatestemplates.gatekeeper.shget, list, watch
* (all constraint kinds)constraints.gatekeeper.shget, list, watch, patch

The Helm chart's default ClusterRole includes these permissions when enterprise.gatekeeper.enabled=true in values.