Analyze Kubernetes YAML files and Helm charts, and check them against a variety of best practices, with a focus on production readiness and security.
KubeLinter is a static analysis tool designed to examine Kubernetes YAML files and Helm charts, ensuring adherence to best practices for production readiness and security. It evaluates configurations against a set of guidelines to identify potential issues, such as insecure settings or operational inefficiencies.
Key Features:
Best Practice Checks: Analyzes configurations for common misconfigurations related to security, resource management, and operational reliability.
Customizable Rules: Allows users to enable, disable, or modify checks to align with organizational policies.
Helm Chart Support: Extends analysis to Helm charts, ensuring consistent compliance across templates.
Extensibility: Supports the creation of custom checks, enabling tailored enforcement of specific security or operational standards.
Integration Capabilities: Designed for seamless integration into CI/CD pipelines, facilitating early detection of issues during development.
Audience & Benefits:
Ideal for Kubernetes developers, DevOps engineers, and security teams, KubeLinter helps organizations maintain secure and reliable containerized applications by identifying misconfigurations early in the development cycle. It promotes adherence to best practices, reducing risks associated with insecure or inefficient deployments. The tool can be installed via winget, ensuring straightforward setup.
README
Static analysis for Kubernetes
What is KubeLinter?
KubeLinter analyzes Kubernetes YAML files and Helm charts, and checks them against a variety of best practices, with a focus on production readiness and security.
KubeLinter runs sensible default checks, designed to give you useful information about your Kubernetes YAML files and Helm charts. This is to help teams check early and often for security misconfigurations and DevOps best practices. Some common examples of these include running containers as a non-root user, enforcing least privilege, and storing sensitive information only in secrets.
KubeLinter is configurable, so you can enable and disable checks, as well as create your own custom checks, depending on the policies you want to follow within your organization.
When a lint check fails, KubeLinter reports recommendations for how to resolve any potential issues and returns a non-zero exit code.
Documentation
Visit https://docs.kubelinter.io for detailed documentation on installing, using and configuring KubeLinter.
Copy the YAML above to pod.yaml and lint this file by running the following command:
kube-linter lint pod.yaml
KubeLinter runs its default checks and reports recommendations. Below is the output from our previous command.
pod.yaml: (object: /security-context-demo /v1, Kind=Pod) The container "sec-ctx-demo" is using an invalid container image, "busybox". Please use images that are not blocked by the `BlockList` criteria : [".*:(latest)$" "^[^:]*$" "(.*/[^:]+)$"] (check: latest-tag, remediation: Use a container image with a specific tag other than latest.)
pod.yaml: (object: /security-context-demo /v1, Kind=Pod) container "sec-ctx-demo" does not have a read-only root file system (check: no-read-only-root-fs, remediation: Set readOnlyRootFilesystem to true in the container securityContext.)
pod.yaml: (object: /security-context-demo /v1, Kind=Pod) container "sec-ctx-demo" has memory limit 0 (check: unset-memory-requirements, remediation: Set memory limits for your container based on its requirements. Refer to https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#requests-and-limits for details.)
Error: found 3 lint errors
To learn more about using and configuring KubeLinter, visit the documentation page.
Mentions/Tutorials
The following are tutorials on KubeLinter written by users. If you have one that you would like to add to this list, please send a PR!
If you would like to engage with the KubeLinter community, including maintainers and other users, you can join the Slack workspace here.
There may be breaking changes in the future to the command usage, flags, and configuration
file formats. However, we encourage you to use KubeLinter to test your environment YAML
files, see what breaks, and contribute.
As a reminder, all participation in the KubeLinter community is governed by our
code of conduct.
KubeLinter is created with ❤️ by StackRox and is now powered
by Red Hat.