Validate Kubernetes Object Creation

3/21/2019

I would like to implement functionality (or even better reuse existing libraries/APIs!) that would intercept a kubectl command to create an object and perform some pre-creation validation tasks on it before allowing kubectl command to proceed.

e.g. check various values in the yaml against external DB for example check a label conforms to the internal naming convention and so on..

Is there an accepted pattern or existing tools etc? Any guidance appreciated

-- user1843591
devops
kubernetes

2 Answers

3/22/2019

I usually append - - dry-run to kubectl command to check and validate the YAML config

-- P Ekambaram
Source: StackOverflow

3/22/2019
-- Janos Lenart
Source: StackOverflow