kubeconform "is invalid against schema" error in CI
kubeconform checked a manifest against the JSON Schema for its apiVersion/kind and it did not conform: a wrong type, an unexpected field, or a missing required field. It prints the resource and the failing path.
What this error means
kubeconform reports "deployment.yaml - Deployment my-app is invalid: ... " with the JSON path and the reason, and exits non-zero.
deployment.yaml - Deployment my-app is invalid: For field spec.replicas: Invalid type.
Expected: integer, given: stringCommon causes
A field with the wrong type
A value like replicas: "3" is a string where the schema requires an integer, so validation fails.
An unknown or misplaced field for that kind
A typo or a field that belongs under a different key is not in the schema for that apiVersion/kind.
How to fix it
Fix the type or field at the reported path
- Read the JSON path and expected type from the message.
- Correct the value (unquote an integer, rename a field, add a required one).
- Re-run kubeconform to confirm.
# wrong
spec:
replicas: "3"
# right
spec:
replicas: 3Validate against the right Kubernetes version
Point kubeconform at the schema set for your target cluster version so field availability matches.
kubeconform -kubernetes-version 1.29.0 -summary deployment.yamlHow to prevent it
- Run kubeconform on manifests in CI against your cluster version.
- Do not quote integer fields like replicas or port.
- Keep CRD schemas available so custom kinds validate too.