error when creating deployment.yaml Deployment in version v1 cannot be handled as a Deployment
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
The error Deployment in version "v1" cannot be handled as a Deployment usually means the manifest says kind: Deployment but uses the wrong API group. Kubernetes validates resources by both kind and apiVersion, so kind alone is not enough.
Why v1 Is Wrong for Deployment
v1 is the core API group used for resources such as Pod, Service, and ConfigMap. A Deployment belongs to the apps API group, so the manifest must use apiVersion: apps/v1.
This is wrong:
Kubernetes sees kind: Deployment paired with the core v1 group and rejects it because that resource does not exist there.
Use the Correct Deployment Shape
A valid minimal deployment needs more than the right API version. It also needs a selector that matches the pod template labels.
The important fixes are:
- '
apiVersion: apps/v1' - '
kind: Deployment' - matching
selector.matchLabelsandtemplate.metadata.labels
Without those pieces, even a manifest with the right API group may still fail validation.
Validate Before Applying
A fast way to catch manifest problems is dry-run validation.
You can also ask the cluster to validate server-side:
This is especially useful when you are learning Kubernetes resource kinds and API groups, because YAML indentation errors and schema errors often appear together.
Understand the Pattern Behind the Error
This error is not unique to Deployments. It is a general Kubernetes pattern: every resource kind belongs to a specific API group and version.
Examples:
- '
Serviceoften usesv1' - '
Deploymentusesapps/v1' - '
Ingressuses a different API group again'
So when you create a manifest, the pair of values must make sense together. If the kind and version do not match the Kubernetes schema, the API server rejects the object before creation.
If you are unsure which fields a resource requires, kubectl explain deployment is a useful companion. It shows the schema Kubernetes expects, which makes it much easier to distinguish a version problem from a missing selector or a malformed pod template.
One more detail trips people up: a Deployment under apps/v1 is expected to manage a ReplicaSet-backed pod template, so the template.spec section must look like a pod spec, not like a service or top-level deployment field list. Once you remember that relationship, the manifest becomes easier to reason about during debugging and review. That mental model is often what turns the error from confusing to obvious quite quickly in practice.
Common Pitfalls
- Using
apiVersion: v1by habit for every Kubernetes resource. - Forgetting that
Deploymentbelongs to theappsAPI group. - Fixing the API version but forgetting the required selector and matching labels.
- Assuming YAML syntax is the only thing to validate when the real issue is schema mismatch.
- Copying old manifests from outdated tutorials without checking the current API version.
Summary
- '
Deploymentis not part of the corev1API group.' - Use
apiVersion: apps/v1together withkind: Deployment. - Make sure the selector and pod-template labels match.
- Use dry-run validation to catch API-version and schema problems before applying the manifest.

