?? End to end LLMOps Pipeline - Part 7- Validating Kubernetes Manifests with kube-score??
Prashant Lakhera
Lead System Engineer @ Salesforce | Ex-Redhat, GenAI, Author of 3 books, Blogger, YouTuber,kubestronaut, MLOps, AWS Bedrock, Hugging Face
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:
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.
IT Director - COMEX member - P&L Leader of Data and Cloud Platform
1 个月My post on KubeScore tests - https://www.dhirubhai.net/posts/olivierlehe_kubescore-optim-de-la-s%C3%A9cu-et-de-la-perf-activity-7238063451380588544-y07D?utm_source=share&utm_medium=member_ios