Convert Figma logo to code with AI

datreeio logodatree

Prevent Kubernetes misconfigurations from reaching production (again 😤 )! From code to cloud, Datree provides an E2E policy enforcement solution to run automatic checks for rule violations. See our docs: https://hub.datree.io

6,384
360
6,384
26

Top Related Projects

22,801

Find vulnerabilities, misconfigurations, secrets, SBOM in containers, Kubernetes, code repositories, clouds and more

6,861

Prevent cloud misconfigurations and find vulnerabilities during build-time in infrastructure as code, container images and open source packages with Checkov by Bridgecrew.

Write tests against structured configuration data using the Open Policy Agent Rego query language

8,441

A vulnerability scanner for container images and filesystems

2,746

Container Image Linter for Security, Helping build the Best-Practice Docker Image, Easy to start

1,205

Security risk analysis for Kubernetes resources

Quick Overview

Datree is an open-source CLI tool that prevents Kubernetes misconfigurations from reaching production. It acts as a policy engine, validating Kubernetes manifests against predefined or custom rules to ensure best practices, security, and compliance standards are met before deployment.

Pros

  • Enhances Kubernetes security and stability by catching misconfigurations early in the development process
  • Offers a wide range of built-in policies and allows for custom rule creation
  • Integrates easily with CI/CD pipelines and local development workflows
  • Provides clear, actionable feedback on policy violations

Cons

  • Requires initial setup and configuration to align with specific project needs
  • May introduce an additional step in the development process, potentially slowing down rapid iterations
  • Learning curve for creating custom policies and understanding all available rules
  • Limited to Kubernetes manifest validation, not applicable for other infrastructure-as-code tools

Getting Started

To get started with Datree, follow these steps:

  1. Install Datree CLI:
curl https://get.datree.io | /bin/bash
  1. Run a policy check on a Kubernetes manifest:
datree test /path/to/your/kubernetes-manifest.yaml
  1. View the results and address any policy violations reported by Datree.

  2. To use Datree in your CI/CD pipeline, add the following step to your workflow:

- name: Run Datree policy check
  uses: datreeio/action-datree@main
  with:
    path: 'path/to/kubernetes/manifests'
    cliArguments: ''

For more advanced usage and custom policy creation, refer to the official Datree documentation.

Competitor Comparisons

22,801

Find vulnerabilities, misconfigurations, secrets, SBOM in containers, Kubernetes, code repositories, clouds and more

Pros of Trivy

  • Broader scope: Scans for vulnerabilities in containers, filesystems, git repositories, and more
  • More comprehensive vulnerability database, including OS packages and language-specific dependencies
  • Faster scanning speed, especially for large images or repositories

Cons of Trivy

  • Less focus on Kubernetes-specific misconfigurations compared to Datree
  • May require more setup and configuration for integration into CI/CD pipelines
  • Potentially overwhelming output for users not familiar with security scanning tools

Code Comparison

Datree (policy as code):

rules:
  - name: Ensure resource limits are set
    rule: resource_limits
    schema:
      type: object
      required: ["limits"]

Trivy (vulnerability scanning):

trivy image --severity HIGH,CRITICAL myapp:latest

Both tools serve different primary purposes: Datree focuses on Kubernetes policy enforcement, while Trivy excels at vulnerability scanning across various targets. Datree's approach is more declarative and Kubernetes-centric, whereas Trivy offers a broader security scanning capability that extends beyond Kubernetes environments.

6,861

Prevent cloud misconfigurations and find vulnerabilities during build-time in infrastructure as code, container images and open source packages with Checkov by Bridgecrew.

Pros of Checkov

  • Broader scope: Supports multiple IaC frameworks (Terraform, CloudFormation, Kubernetes, etc.)
  • Extensive policy library: Offers 1000+ built-in policies for various cloud providers
  • Integration with CI/CD pipelines: Easy to incorporate into existing workflows

Cons of Checkov

  • Steeper learning curve: More complex configuration due to broader scope
  • Resource-intensive: May require more computational resources for large-scale scans
  • Less focus on Kubernetes: While supported, not as specialized as Datree for K8s

Code Comparison

Checkov:

from checkov.common.models.enums import CheckResult, CheckCategories
from checkov.kubernetes.checks.resource.base_spec_check import BaseK8Check

class ExampleCheck(BaseK8Check):
    def __init__(self):
        name = "Ensure example policy is followed"
        check_id = "CKV_K8S_EXAMPLE"
        supported_kinds = ['Deployment', 'Pod']
        categories = [CheckCategories.KUBERNETES]
        super().__init__(name=name, check_id=check_id, categories=categories, supported_kinds=supported_kinds)

Datree:

rules:
  - name: Ensure resource limits are set
    rule:
      operator: exists
      path: spec.template.spec.containers[*].resources.limits
    message: Resource limits should be set for all containers

Write tests against structured configuration data using the Open Policy Agent Rego query language

Pros of Conftest

  • More flexible and extensible policy language (Rego)
  • Supports a wider range of configuration file formats
  • Can be integrated into various CI/CD pipelines and workflows

Cons of Conftest

  • Steeper learning curve for writing policies in Rego
  • Less user-friendly for non-technical team members
  • Requires more setup and configuration compared to Datree

Code Comparison

Datree policy example:

rules:
  - name: Ensure resource limits are set
    rule: resource_limits_set
    message: Resource limits should be set for all containers

Conftest policy example:

package main

deny[msg] {
  input.kind == "Deployment"
  not input.spec.template.spec.containers[_].resources.limits
  msg = "Resource limits should be set for all containers"
}

Both tools aim to enforce policies on Kubernetes manifests, but Conftest offers more flexibility with its Rego-based policy language, while Datree provides a simpler YAML-based approach. Conftest supports a broader range of configuration files, making it more versatile for complex environments. However, Datree's simplicity and built-in rules make it more accessible for teams looking for quick policy enforcement without extensive customization.

8,441

A vulnerability scanner for container images and filesystems

Pros of Grype

  • Focuses specifically on vulnerability scanning for container images and filesystems
  • Supports multiple operating systems and package formats
  • Integrates with Syft for improved Software Bill of Materials (SBOM) generation

Cons of Grype

  • Limited to vulnerability scanning, lacks policy enforcement capabilities
  • Requires additional tools for comprehensive container security
  • May have a steeper learning curve for users new to vulnerability scanning

Code Comparison

Grype (scanning a container image):

grype alpine:latest

Datree (checking Kubernetes manifests):

datree test ./k8s-manifests

Summary

Grype is a specialized tool for vulnerability scanning in container images and filesystems, supporting various operating systems and package formats. It integrates well with other tools like Syft for improved SBOM generation. However, it lacks policy enforcement capabilities and may require additional tools for comprehensive container security.

Datree, on the other hand, focuses on policy enforcement and best practices for Kubernetes manifests. It provides a more comprehensive approach to preventing misconfigurations in Kubernetes deployments but may not offer the same depth of vulnerability scanning as Grype.

The choice between these tools depends on the specific needs of your project, with Grype being more suitable for dedicated vulnerability scanning and Datree for Kubernetes policy enforcement and best practices.

2,746

Container Image Linter for Security, Helping build the Best-Practice Docker Image, Easy to start

Pros of Dockle

  • Focused specifically on Docker image linting and security scanning
  • Lightweight and fast, with minimal dependencies
  • Provides CIS benchmarks for Docker images out of the box

Cons of Dockle

  • Limited to Docker image analysis, while Datree covers broader policy checks
  • Fewer integrations with CI/CD platforms compared to Datree
  • Less extensive documentation and community support

Code Comparison

Dockle usage:

dockle image:tag

Datree usage:

datree test ./path/to/manifest.yaml

Both tools aim to improve container and Kubernetes security, but they approach it differently. Dockle focuses on Docker image analysis, while Datree provides a more comprehensive policy enforcement solution for Kubernetes manifests and other configuration files.

Dockle excels at identifying vulnerabilities and misconfigurations in Docker images, making it valuable for teams primarily working with containers. Its lightweight nature and built-in CIS benchmarks make it easy to integrate into existing workflows.

Datree, on the other hand, offers a broader scope of policy checks across various configuration files, including Kubernetes manifests. It provides more extensive customization options and integrations with popular CI/CD platforms, making it suitable for teams looking for a more comprehensive policy enforcement solution.

1,205

Security risk analysis for Kubernetes resources

Pros of Kubesec

  • Focused specifically on Kubernetes security scanning
  • Provides a security risk score for each manifest
  • Offers both CLI and web interface options

Cons of Kubesec

  • Less comprehensive policy coverage compared to Datree
  • Limited to Kubernetes manifests, while Datree supports multiple resource types
  • Fewer integrations with CI/CD tools and platforms

Code Comparison

Kubesec example output:

{
  "score": 3,
  "scoring": {
    "critical": 0,
    "high": 1,
    "medium": 0,
    "low": 0
  },
  "passed": [
    {
      "selector": "containers[] .securityContext .runAsNonRoot == true",
      "reason": "Container runs as non-root user"
    }
  ]
}

Datree example output:

[V] YAML validation
[V] Policy check
[X] Failed checks:
    [1] Ensure each container image has a pinned (tag) version
    [2] Ensure CPU request is set
    [3] Ensure memory request is set

3 tests failed

Both tools aim to improve Kubernetes security and best practices, but Kubesec focuses specifically on security scoring for Kubernetes manifests, while Datree offers a broader range of policy checks and supports multiple resource types beyond Kubernetes.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

datree=github

Explore the docs »

Datree [DEPRECATED]

Datree (pronounced /da-tree/) was built to secure Kubernetes workloads by blocking the deployment of misconfigured resources. Since July 2023, the commercial company that supports and actively maintains this project has been closed.

Migrating to the (fully) open-source version of Datree

For existing users, it is still possible to run Datree as a standalone: https://hub.datree.io/cli/offline-mode

What will not be available anymore

All the archived open source repositories under datreeio org will no longer be maintained and accept any new code changes, including any security patches. In addition, the following key capabilities will not longer be available anymore:

  • Centralized policy registry
  • Automatic Kubernetes schema validation
  • Access to the dashboard and all of its components (e.g. activity-log page, token management, etc.)

⚙️ How it works

Datree scans Kubernetes resources against a centrally managed policy, and blocks those that violate your desired policies.

Datree comes with over 100 rules covering various use-cases, such as workload security, high availability, ArgoCD best practices, NSA hardening guide, and many more.

In addition to our built-in rules, you can write any custom rule you wish and then run it against your Kubernetes configurations to check for rule violations. Custom rules can be written in JSON schema or in Rego.

Contributing

We want to thank our contributors for helping us build Datree ❤️

Contributors