A manifest that is wrong is rejected with a message. The message tells you what kind of wrong it is.
Three kinds of error
1. It does not parse
error: error parsing web.yaml: error converting YAML to JSON: yaml: A block sequence may not be used as an implicit map key at line 6, column 15Nearly always indentation. Open the file and look at the named line and the one above it. A list item (- ) and its parent key must line up the way the lesson "Write a Manifest" showed.
2. Unknown kind or version
error: resource mapping not found for name: "api" ... no matches for kind "Pdo" in version "v1"The kind is misspelled, or the apiVersion is wrong for that kind. kubectl api-resources lists the right spelling and the right APIVERSION side by side.
3. Wrong or missing field
error: error validating "db.yaml": error validating data: ValidationError(Pod.spec.containers[0]): unknown field "imag" in io.k8s.api.core.v1.ContainerThe path in brackets, Pod.spec.containers[0], is the first container. A key there is not in the schema: imag: is a typo for image:. Leave a required field out instead and the message says missing required field "image". kubectl explain pod.spec.containers has the exact names.
The method
- Read the first line of the error. Decide which of the three it is.
- Go to the place it names: a line number, a kind, or a field path.
- Fix the file, apply again. One error at a time.