I’m looking for how to rollback a k8s deploy when timeout happen. I’m using Jenkins for CICD. I want to prevent deploy with typos or something like that in resource configs. If there’s a way to verify all the configs (templates and charts) before the deploy step please tell me.
Have you taken a look at Kubeval?
You can run validation against the K8s configs by running the command kubeval --strict myfile.yaml
. It’s pretty snazzy
Another option can be using kubectl’s dry-run mode (–dry-run, --server-dry-run).
Thanks @tomasz.prus, with the flag --dry-run kubernetes or helm validate my templates for me.
Ref: https://helm.sh/docs/chart_template_guide/debugging/#scrollpane
For future reference - there are two OSS tools and a native option (kubectl) to do it.
OSS:
kubectl:
--dry-run=server
--dry-run=client
The OSS tools DON’T require a connection to your cluster but kubectl --dry-run=server
will provide better (validation) results.
I compared the tools and wrote an article about it with all the details.
1 Like