Two kubeconform runs from my test folder, both exit 0, both on broken manifests. The first has replica: where replicas: should be. The second has kind: Deploymnet. If your CI only looks at the exit code, both go green.
Here's what caused each one and the flags I'd use instead. Everything ran with kubeconform v0.8.0 on Linux, no cluster. The [exit N] lines are added by my test script.
A misspelled field passes without -strict
$ kubeconform -summary typo-field.yaml Summary: 1 resource found in 1 file - Valid: 1, Invalid: 0, Errors: 0, Skipped: 0 [exit 0] The default schemas allow properties they don't list. With -strict, kubeconform switches to the strict schema set and the typo shows up:
$ kubeconform -strict -summary typo-field.yaml typo-field.yaml - Deployment web is invalid: problem validating schema. Check JSON formatting: jsonschema validation failed with 'https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/master-standalone-strict/deployment-apps-v1.json#' - at '/spec': additional properties 'replica' not allowed [exit 1] -ignore-missing-schemas also hides a misspelled kind
Custom resources like a cert-manager Certificate fail with could not find schema for Certificate. The quick fix people reach for is -ignore-missing-schemas. But to kubeconform, a typo'd kind is just another kind with no schema:
$ kubeconform -summary -ignore-missing-schemas typo-kind.yaml Summary: 1 resource found in 1 file - Valid: 0, Invalid: 0, Errors: 0, Skipped: 1 [exit 0] Valid: 0 and exit 0. Two narrower options worked for me. -skip Certificate skips that one kind and still fails the typo:
$ kubeconform -summary -skip Certificate typo-kind.yaml typo-kind.yaml - Deploymnet web failed validation: could not find schema for Deploymnet [exit 1] Better still, add Datree's CRDs-catalog (the kubeconform README suggests it) as a second schema location, so the Certificate is actually validated:
$ kubeconform -strict -summary -schema-location default -schema-location https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json crd-certificate.yaml Summary: 1 resource found in 1 file - Valid: 1, Invalid: 0, Errors: 0, Skipped: 0 [exit 0] It's a third-party repo, so its schema may lag the CRD version you run.
"could not find schema" can mean a removed API
kubeconform validates against master unless you pass -kubernetes-version. A policy/v1beta1 PodDisruptionBudget passed on 1.24.0 and failed on 1.25.0:
$ kubeconform -summary -kubernetes-version 1.25.0 removed-api.yaml removed-api.yaml - PodDisruptionBudget web failed validation: could not find schema for PodDisruptionBudget [exit 1] That matches the Kubernetes deprecation guide: that API version is no longer served as of v1.25. Pin the version your cluster runs, and when you see this error, check apiVersion first.
Two CI details
-
-cachefails on a folder that doesn't exist instead of creating it:failed opening cache folder ../work/cache: stat ../work/cache: no such file or directory. Runmkdir -pfirst. - With the network cut off, a warm cache still passed. A cold run failed with
failed downloading schema ... giving up after 3 attempt(s). So cache the schemas in CI.
What kubeconform can't catch: a Deployment whose selector doesn't match its pod labels came back Valid: 1. That's a job for a server-side dry run, which I didn't test.
The full write-up, with the pinned GitHub Actions workflow, every raw output and the scripts to reproduce them, is on Runbook Lab.
Disclosure: I wrote this with an AI assistant. The commands were run for real in a scratch environment and the outputs above are copied from those runs.

