Error validating data

When you are writing your own manifests for Kubernetes and using them directly, it is very easy to make simple mistakes that result in the error message : error validating ....

These are fortunately very easy to understand, if terribly inconvenient. To illustrate this example, I created a slightly broken deployment manifest:

When running kubectl apply with this manifest, you will receive an error:

error: error validating "test.yml": error validating data: [ValidationError(Deployment.spec.template.spec.containers[0]): unknown field "named" in io.k8s.api.core.v1.Container, ValidationError(Deployment.spec.template.spec.containers[0]): ...

Get Kubernetes for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.