🤖 End to end LLMOps Pipeline — Part 7- Validating Kubernetes Manifests with kube-score🤖

Prashant Lakhera
2 min readAug 19, 2024

--

Before deploying Kubernetes manifests to a cluster, it’s essential to validate them to ensure they follow best practices. This is where tools like kube-score come in handy. In today’s post, we’ll explore how kube-score can be a valuable asset in your Kubernetes workflow, especially when integrating it into CI/CD pipelines.

Using kube-score to Validate Kubernetes Manifests

kube-score is a tool designed to help you validate and improve the quality of your Kubernetes manifests. By performing a static analysis of your manifests, it provides recommendations that can enhance the efficiency, security, and reliability of your configurations. This tool is particularly useful in CI/CD pipelines, where it ensures that your Kubernetes configurations adhere to industry best practices before deployment.

Installing kube-score

Installing kube-score is straightforward and can be done by following the instructions on the kube-score GitHub repository https://github.com/zegl/kube-score

curl -L -o kube-score https://github.com/zegl/kube-score/releases/download/v1.11.0/kube-score_1.11.0_linux_amd64
chmod +x kube-score
sudo mv kube-score /usr/local/bin/

For Linux users, downloading the binary file from the official GitHub releases page is a quick and efficient method. If you prefer using Docker, you can run kube-score directly in a container, making it flexible for different environments.

Validating Your Kubernetes Manifests with kube-score

Once kube-score is installed, validating your Kubernetes manifests is simple. Use the following command:

kube-score score --output-format ci deploy.yaml

Here’s what each part of the command does:

  • kube-score score: This runs kube-score to analyze the specified Kubernetes YAML file, which is deploy.yaml in this case.
  • — output-format ci: This option formats the output for continuous integration (CI) systems, making it concise and easily parsable by CI tools.
  • deploy.yaml: This is the file being analyzed by kube-score. Replace this with the path to your actual Kubernetes manifest file if different.

Output

After running the command, kube-score will provide a list of checks performed on your manifest. These checks include warnings or recommendations for improvement. For example:

[WARNING] Container Resources
· gptcontainer -> No resource limits set for container
Resource limits are recommended to avoid resource contention issues in the cluster.
Set resource limits using 'resources.limits.cpu' and 'resources.limits.memory'.
[OK] Pod Probes
· gptcontainer -> Liveness probe is configured
· gptcontainer -> Readiness probe is configured

These detailed outputs help identify potential issues before your manifests are deployed to a live cluster, ensuring a smoother and more reliable deployment process.

📚 If you enjoy these blog posts, please check out my three books on AWS, DevOps, and Machine Learning.

https://pratimuniyal.gumroad.com/l/BuildinganLLMOpsPipelineUsingHuggingFace

https://pratimuniyal.gumroad.com/l/cracking-the-devops-interview

https://www.amazon.com/AWS-System-Administrators-automate-infrastructure/dp/1800201532

--

--

Prashant Lakhera

AWS Community Builder, Ex-Redhat, Author, Blogger, YouTuber, RHCA, RHCDS, RHCE, Docker Certified,4XAWS, CCNA, MCP, Certified Jenkins, Terraform Certified, 1XGCP