ConfigsApr 16, 2026·3 min read

Datree — Policy Enforcement for Kubernetes Configurations

Prevent Kubernetes misconfigurations from reaching production. Datree validates manifests against built-in and custom rules in CI or the CLI.

TL;DR
Policy enforcement tool that validates Kubernetes manifests against built-in and custom rules in CI pipelines or the CLI.
§01

What it is

Datree is a policy enforcement tool for Kubernetes configurations. It validates YAML manifests against built-in and custom rules before they reach your cluster, catching misconfigurations in CI/CD pipelines or during local development.

Datree targets DevOps teams that want to prevent common Kubernetes mistakes: missing resource limits, privileged containers, latest image tags, missing health checks, and insecure settings. It ships with a library of built-in rules and supports custom policies.

§02

How it saves time or tokens

Kubernetes misconfigurations are the leading cause of security incidents and outages in container environments. Catching them before deployment saves debugging time and prevents incidents. Datree shifts policy validation left, running checks before kubectl apply rather than after a production failure.

For AI-generated Kubernetes manifests, Datree acts as a safety net. LLMs sometimes produce valid YAML that violates best practices. Datree catches these issues automatically.

§03

How to use

  1. Install the Datree CLI:
curl https://get.datree.io | /bin/bash
  1. Validate a Kubernetes manifest:
datree test deployment.yaml
  1. Datree checks the manifest against its built-in rules and reports violations:
>> File: deployment.yaml
[X] Ensure each container has a configured memory limit
[X] Ensure each container image has a pinned tag
[V] Ensure containers do not run as privileged
  1. Add Datree to your CI pipeline to block deployments that violate policies.
§04

Example

# This manifest would fail Datree validation:
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
spec:
  template:
    spec:
      containers:
      - name: app
        image: myapp:latest  # Fails: unpinned tag
        # Fails: no resource limits
        # Fails: no readiness probe
§05

Related on TokRepo

§06

Common pitfalls

  • Enabling all rules at once in an existing project. Start with critical rules (resource limits, security context) and gradually add more as your team fixes existing violations.
  • Not creating custom rules for your organization. The built-in rules cover general best practices, but every team has specific requirements (naming conventions, label standards, namespace policies).
  • Treating Datree as a replacement for runtime security. Datree validates static manifests. You still need runtime tools like Falco or OPA Gatekeeper for in-cluster policy enforcement.
  • Failing to review community discussions and changelogs before upgrading. Breaking changes in major versions can disrupt existing workflows. Pin versions in production and test upgrades in staging first.

Frequently Asked Questions

What rules does Datree enforce by default?+

Datree ships with rules covering resource limits, security contexts, image tags, health probes, label requirements, and namespace isolation. The default policy includes about 30 rules based on Kubernetes best practices and CIS benchmarks.

Can I create custom Datree rules?+

Yes. Datree supports custom rules defined in YAML or through the Datree dashboard. Custom rules can validate any field in a Kubernetes manifest using JSONPath expressions and conditions. This lets you enforce organization-specific standards.

How does Datree integrate with CI/CD?+

Datree runs as a CLI command that returns a non-zero exit code when violations are found. Add datree test to your CI pipeline (GitHub Actions, GitLab CI, Jenkins) and it blocks merges or deployments that violate policies.

How does Datree compare to OPA Gatekeeper?+

Datree validates manifests before deployment (shift-left) while OPA Gatekeeper enforces policies at admission time in the cluster. Datree is easier to set up and provides faster feedback in CI. Gatekeeper catches issues at deploy time as a last line of defense. Many teams use both.

Does Datree work with Helm charts?+

Yes. Datree can validate rendered Helm templates. Run helm template to render the chart, then pipe the output to datree test. This validates the actual manifests that Helm would apply to your cluster.

Citations (3)

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets