Kubeval Online
Posted 5 Jan 2018
Validate Kubernetes (k8s) yaml files online.
This project was inspired by and based on garethr’s kubeval. After attending his talk at Kubecon in December 2017 I put this together to make use of kubeval to perform validations by pasting into a web interface. Garethr’s kubeval already has a nice CLI you can use as part of a CI/CD system, and kubevalonline supplements this tool for use during the development process.
Given a kubernetes configuration file with an invalid value such as:
apiVersion: v1
kind: Service
metadata:
name: redis-master
labels:
app: redis
tier: backend
role: master
spec:
ports:
# the port that this service should serve on
- port: sds
targetPort: 6379
selector:
app: redis
tier: backend
role: master
kubeval recognizes that port values should be integer type and not string type then responds with an error:
{
"Results": [
{
"Kind": "Service",
"Success": false,
"Errors": [
"Invalid type. Expected: integer, given: string"
]
}
]
}
kubectl run
provides a --dry-run
flag which can also be used to partially verify that a declaration is valid, but kubeval provides additional information that is valuable when debugging. A handy tool for the kubernaut!
The source code is hosted on github. The image can be pulled from dockerhub.