Kube-score to Kubernetes Manifest Validation

Matías Salinas
2 min readApr 8, 2023

--

Kubernetes has become the de facto standard for container orchestration, enabling organizations to deploy and manage containerized applications at scale. However, with this scale comes the need for robust security measures to protect against potential attacks. Kube-score is a tool designed to scan Kubernetes manifests for best practices and common mistakes, helping organizations to validate their configurations and improve their security posture.

What is Kube-score?

Kube-score is an open-source tool that scans Kubernetes manifests for best practices and common mistakes. It is designed to help organizations validate their configurations and improve their security posture. Kube-score is built on top of the open-source Kubernetes API schema, and it works by analyzing the manifests against a set of predefined rules.

How to Use Kube-score

To run a scan with Kube-score, simply run the following command:

docker run --rm -v /path/to/kubernetes/manifests:/project zegl/kube-score:v1.12.0 score /project

This will initiate a scan of the Kubernetes manifests and report back any potential issues. By default, Kube-score will scan for common mistakes, such as misconfigured resource requests and limits.

Kube-score also supports a number of command-line arguments that can be used to customize the scan. For example, the --ignore-tests argument can be used to ignore certain tests that are not applicable to the manifests being scanned.

Once the scan is complete, Kube-score will generate a report detailing any potential issues found in the manifests. The report includes a summary of the issues, as well as details on each issue and recommendations for remediation.

Here is an example of Kube-score output:

[CRITICAL][Deployment nginx] No resource limits set
Containers should have resource limits set
Add `resources.limits.cpu` and `resources.limits.memory` to the container
[INFO][Deployment nginx] Readiness probe missing
Add a readiness probe to the container
[WARNING][Deployment nginx] Liveness probe missing
Add a liveness probe to the container

As you can see, the output provides detailed information about each issue found, including the severity level, issue description, and recommendations for remediation.

Conclusion

Kube-score is a powerful tool for validating Kubernetes manifests against best practices and common mistakes. By identifying and addressing potential issues before they can cause problems, organizations can better protect their Kubernetes clusters and the applications running on them. With its easy installation process, simple command-line interface, and comprehensive output, Kube-score is an essential tool for any organization running Kubernetes. To learn more about Kube-score, visit the project’s GitHub repository at https://github.com/zegl/kube-score.

--

--

Matías Salinas
Matías Salinas

No responses yet