Skip to content
Latchkey

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.

kubeconform
deployment.yaml - Deployment my-app is invalid: For field spec.replicas: Invalid type.
Expected: integer, given: string

Common 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

  1. Read the JSON path and expected type from the message.
  2. Correct the value (unquote an integer, rename a field, add a required one).
  3. Re-run kubeconform to confirm.
deployment.yaml
# wrong
spec:
  replicas: "3"
# right
spec:
  replicas: 3

Validate against the right Kubernetes version

Point kubeconform at the schema set for your target cluster version so field availability matches.

Terminal
kubeconform -kubernetes-version 1.29.0 -summary deployment.yaml

How 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.

Frequently asked questions

What causes ""is invalid: ... against schema""?
A value like replicas: "3" is a string where the schema requires an integer, so validation fails.
How do I fix "is invalid: ... against schema"?
Fix the type or field at the reported path

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card