kubeval
Validate your Kubernetes configuration files, supports multiple Kubernetes versions
Top Related Projects
A FAST Kubernetes manifests validator, with support for Custom Resources!
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
KubeLinter is a static analysis tool that checks Kubernetes YAML files and Helm charts to ensure the applications represented in them adhere to best practices.
Security risk analysis for Kubernetes resources
Container Image Linter for Security, Helping build the Best-Practice Docker Image, Easy to start
Quick Overview
Kubeval is a tool for validating Kubernetes configuration files. It helps ensure that your YAML or JSON manifests are compliant with the Kubernetes schema, catching errors before they cause issues in your cluster. Kubeval supports multiple Kubernetes versions and can be integrated into CI/CD pipelines for automated validation.
Pros
- Supports validation against multiple Kubernetes versions
- Can be easily integrated into CI/CD pipelines
- Provides detailed error messages for invalid configurations
- Supports both YAML and JSON formats
Cons
- Limited to schema validation, doesn't catch all potential runtime issues
- Requires regular updates to support new Kubernetes versions
- May produce false positives for custom resources or third-party operators
- Limited support for validating Helm charts or Kustomize outputs
Code Examples
- Validating a single file:
kubeval my-deployment.yaml
- Validating multiple files:
kubeval *.yaml
- Validating against a specific Kubernetes version:
kubeval --kubernetes-version 1.18.0 my-deployment.yaml
- Using strict mode for additional checks:
kubeval --strict my-deployment.yaml
Getting Started
To get started with Kubeval, follow these steps:
-
Install Kubeval:
# For macOS using Homebrew brew tap instrumenta/instrumenta brew install kubeval # For Linux wget https://github.com/instrumenta/kubeval/releases/latest/download/kubeval-linux-amd64.tar.gz tar xf kubeval-linux-amd64.tar.gz sudo cp kubeval /usr/local/bin
-
Validate a Kubernetes manifest:
kubeval path/to/your/manifest.yaml
-
For CI/CD integration, add Kubeval to your pipeline:
# Example GitLab CI job validate_manifests: image: garethr/kubeval script: - kubeval manifests/*.yaml
Competitor Comparisons
A FAST Kubernetes manifests validator, with support for Custom Resources!
Pros of Kubeconform
- Faster execution due to parallel processing of files and resources
- Supports multiple schema sources, including local files and HTTP(S) endpoints
- Smaller binary size and fewer dependencies
Cons of Kubeconform
- Less mature project with potentially fewer community contributions
- May lack some advanced features present in Kubeval
Code Comparison
Kubeval:
kubeval my-manifest.yaml
Kubeconform:
kubeconform my-manifest.yaml
Both tools use similar command-line syntax for basic validation, but Kubeconform offers additional options for schema sources and parallel processing:
kubeconform -schema-location default -schema-location 'https://example.com/schemas/{{.Group}}-{{.Version}}-{{.Kind}}.json' -n 4 my-manifests/
Summary
Kubeconform is a newer alternative to Kubeval, offering improved performance and flexibility in schema sources. However, Kubeval has a longer history and potentially more community support. Both tools serve the same primary purpose of validating Kubernetes manifests against schemas, with Kubeconform providing some additional features and optimizations.
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
Pros of Datree
- Offers a more comprehensive policy engine with customizable rules
- Provides a web-based dashboard for visualizing and managing policy violations
- Integrates with CI/CD pipelines and offers real-time feedback
Cons of Datree
- Requires an account and potentially a paid subscription for advanced features
- May have a steeper learning curve due to its more complex policy system
Code Comparison
Kubeval usage:
kubeval my-manifest.yaml
Datree usage:
datree test my-manifest.yaml
Both tools validate Kubernetes manifests, but Datree offers more advanced policy checks and customization options. Kubeval focuses primarily on schema validation, while Datree provides a broader range of checks and integrations.
Kubeval is simpler to use and doesn't require an account, making it ideal for quick validations. Datree, on the other hand, offers more comprehensive policy enforcement and management features, making it suitable for larger teams and more complex Kubernetes environments.
Choose Kubeval for straightforward schema validation or Datree for advanced policy enforcement and team collaboration features.
KubeLinter is a static analysis tool that checks Kubernetes YAML files and Helm charts to ensure the applications represented in them adhere to best practices.
Pros of kube-linter
- More comprehensive checks, including security and best practices
- Actively maintained with regular updates
- Supports custom checks and configuration
Cons of kube-linter
- Slower performance for large-scale analysis
- Steeper learning curve due to more complex configuration options
Code comparison
kubeval example:
apiVersion: v1
kind: Pod
metadata:
name: example
spec:
containers:
- name: example
image: example:latest
kube-linter example:
checks:
- name: latest-tag
description: Ensure container images use specific tags
remediation: Use a specific tag instead of 'latest'
template: image-tag
params:
forbiddenTags:
- latest
Both tools validate Kubernetes manifests, but kube-linter offers more advanced linting capabilities with customizable checks. kubeval focuses primarily on schema validation, while kube-linter provides a broader range of checks for security, efficiency, and best practices.
kube-linter's configuration allows for more fine-grained control over checks and can be integrated into CI/CD pipelines more easily. However, this increased flexibility comes at the cost of a steeper learning curve and potentially slower performance for large-scale analyses.
Overall, kube-linter is better suited for teams looking for comprehensive Kubernetes manifest validation, while kubeval may be preferred for simpler schema validation tasks.
Security risk analysis for Kubernetes resources
Pros of Kubesec
- Focuses specifically on security-related issues in Kubernetes manifests
- Provides a risk score and detailed explanations for each security issue found
- Offers both CLI and web-based interfaces for analysis
Cons of Kubesec
- More limited scope compared to Kubeval, focusing only on security aspects
- May require more frequent updates to stay current with evolving security best practices
- Less extensive documentation and community support
Code Comparison
Kubeval example:
apiVersion: v1
kind: Pod
metadata:
name: myapp
spec:
containers:
- name: myapp
image: myapp:latest
Kubesec example:
apiVersion: v1
kind: Pod
metadata:
name: myapp
spec:
securityContext:
runAsNonRoot: true
containers:
- name: myapp
image: myapp:latest
securityContext:
readOnlyRootFilesystem: true
Kubeval focuses on validating the overall structure and syntax of Kubernetes manifests, while Kubesec emphasizes security-specific configurations. The Kubesec example includes additional security-related settings like runAsNonRoot
and readOnlyRootFilesystem
.
Both tools serve different purposes: Kubeval for general manifest validation and Kubesec for security-focused analysis. Users may benefit from using both tools in their Kubernetes development and deployment workflows to ensure both structural correctness and security best practices.
Container Image Linter for Security, Helping build the Best-Practice Docker Image, Easy to start
Pros of Dockle
- Focuses on Docker image security and best practices
- Provides CIS benchmarks for Docker images
- Offers a comprehensive set of checks for Dockerfile and image content
Cons of Dockle
- Limited to Docker image analysis, not applicable to Kubernetes manifests
- May require more setup time for custom rules compared to Kubeval
Code Comparison
Dockle:
dockle --exit-code 1 --exit-level warn myimage:latest
Kubeval:
kubeval my-deployment.yaml
Summary
Dockle and Kubeval serve different purposes in container-related validation. Dockle specializes in Docker image security and best practices, offering CIS benchmarks and comprehensive checks. It's ideal for teams focused on Docker image quality and security.
Kubeval, on the other hand, validates Kubernetes manifests against the official Kubernetes schema. It's more suitable for teams working directly with Kubernetes configurations and ensuring their correctness.
While both tools contribute to container ecosystem quality, they target different aspects of the development and deployment process. Dockle is more focused on the container image itself, while Kubeval concentrates on the Kubernetes deployment configurations.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Kubeval
NOTE: This project is no longer maintained, a good replacement is kubeconform
kubeval
is a tool for validating a Kubernetes YAML or JSON configuration file.
It does so using schemas generated from the Kubernetes OpenAPI specification, and
therefore can validate schemas for multiple versions of Kubernetes.
$ kubeval my-invalid-rc.yaml
WARN - fixtures/my-invalid-rc.yaml contains an invalid ReplicationController - spec.replicas: Invalid type. Expected: [integer,null], given: string
$ echo $?
1
For full usage and installation instructions see kubeval.com.
Top Related Projects
A FAST Kubernetes manifests validator, with support for Custom Resources!
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
KubeLinter is a static analysis tool that checks Kubernetes YAML files and Helm charts to ensure the applications represented in them adhere to best practices.
Security risk analysis for Kubernetes resources
Container Image Linter for Security, Helping build the Best-Practice Docker Image, Easy to start
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot