Invalid Kubernetes manifest: unknown field
Quick summary
Your Kubernetes manifest has an unknown field — the API server rejects the resource definition.
Why this happens
A field name is misspelled or does not exist in the Kubernetes API for the resource type
The field is from a different API version than the one specified in apiVersion
A custom resource definition field is used without the CRD being installed
Minimal example
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 3
selector:
matchLabels:
app: web
templete: # typo: templete instead of template
metadata:
labels:
app: webapiVersion: apps/v1
kind: Deployment
spec:
replicas: 3
selector:
matchLabels:
app: web
template: # correct field name
metadata:
labels:
app: webCorrecting the field name from 'templete' to 'template' makes the manifest valid for the Kubernetes API.
How to diagnose
Use kubectl apply --dry-run=client to validate the manifest before applying
Check the Kubernetes API reference for valid fields for the resource type and apiVersion
Verify that any CRDs referenced in the manifest are installed in the cluster
How to fix
Correct the field name to match the Kubernetes API for the resource type
Change the apiVersion to one that supports the field being used
Install the required CRD before applying the manifest that uses its fields
How to prevent
Use kubectl apply --dry-run=client or a manifest validator in CI to catch errors early
Keep Kubernetes manifests in sync with the cluster's API version and installed CRDs
Related Resources
Related Glossary
Related Lessons
- Kubernetes
Learn about manifests.