talira

Gatekeeper

Policy Controller for Kubernetes

open sourceApache-2.0self-hostablefree

Gatekeeper is a validating and mutating admission webhook for Kubernetes that enforces policies defined as custom resources and executed by Open Policy Agent. A ConstraintTemplate holds the logic, in Rego or in CEL through its K8sNativeValidation engine, and Constraints apply it with parameters, to deny, warn or dry-run; audit reports the existing resources that violate a policy, and mutators (Assign, AssignMetadata, ModifySet, AssignImage) change resources at admission. It can also generate Kubernetes ValidatingAdmissionPolicy resources from CEL templates, and the gator CLI tests templates and constraints locally or in CI. It's part of the Open Policy Agent project, Apache-2.0, with a library of ready-made policies.

Ways to install

Problems it solves

  • block pods that run as root or use privileged mode from ever being created in the cluster
  • require every namespace and deployment to carry an owner label before the API server accepts it
  • find all existing resources in the cluster that break our rules, not just new ones
  • only allow container images from our own registry across all clusters
  • set default labels, image tags or security settings on resources automatically as they're created
  • write cluster admission rules once and reuse them with different parameters per team
  • test admission policies in CI against manifests before they reach the cluster
  • roll out a new cluster rule in warn or dry-run mode first to see what it would block
  • enforce our admission rules with the API server's built-in CEL policies instead of a webhook
  • start from a library of common pod security and compliance rules instead of writing them from scratch

Features

  • ConstraintTemplate and Constraint custom resources
  • Rego and CEL (K8sNativeValidation) engines
  • deny, warn, dry-run and scoped enforcement actions
  • audit of existing resources against policies
  • mutation with AssignMetadata, Assign, ModifySet and AssignImage
  • generates ValidatingAdmissionPolicy and bindings from CEL templates (Kubernetes 1.30+)
  • gator CLI: test, verify, expand, sync test, bench and policy commands
  • Gatekeeper policy library of parameterized policies
  • Helm chart and prebuilt manifests

Limitations

  • The gator CLI isn't tested on Windows: only Linux is tested on each commit4

Capabilities

Has a command line toolplan not known

Alternatives

The same job

These do what Gatekeeper does.

  1. Kyverno Unified Policy as Code
  2. Kubewarden Manage admission policies in your Kubernetes cluster with ease

Compare Gatekeeper with the top 3