Argo CD sync "error validating data" schema failure in CI
During apply, the API server validates each object against its schema. error validating data means a field is unknown, has the wrong type, or is missing a required value, so the resource is rejected before it is created or updated.
What this error means
Sync fails with "error validating data: ValidationError(...)" naming the field, for example an unknown field or a string where an integer is expected.
error validating data: ValidationError(Deployment.spec.template.spec.containers[0]):
unknown field "port" in io.k8s.api.core.v1.Container; if you choose to ignore these
errors, turn validation off with --validate=falseCommon causes
A misspelled or wrong-level field
A key such as port placed where ports belongs, or a field at the wrong nesting level, is not in the schema and fails validation.
A type mismatch
A quoted string where an integer is required (or vice versa) makes the API server reject the value.
How to fix it
Correct the field against the schema
- Read the ValidationError path to find the exact field.
- Fix the spelling, nesting, or type in the manifest.
- Validate against the live schema before re-syncing.
kubectl apply --dry-run=server -f deploy.yamlValidate manifests in CI
Run a schema validator in the pipeline so a bad field fails the build instead of the sync.
- run: kubeconform -strict -summary manifests/How to prevent it
- Run kubeconform or
kubectl apply --dry-run=serverin CI before sync. - Do not disable validation to force a manifest through.
- Pin manifest apiVersions to what the target cluster supports.