⌂ Home

Editors, validation, and fixing broken manifests

Make YAML editing pleasant: VS Code extensions, safe online validators, kubectl dry-run and diff, and a troubleshooting matrix for the errors learners hit most often in labs.

Prerequisites: Part 1 and Part 2. This part is about workflow and debugging—so you spend less time staring at parse errors and more time learning Kubernetes behavior.

Visual Studio Code (recommended setup)

Daily driver for labs

YAML (Red Hat)

Extension ID: redhat.vscode-yaml. Provides syntax highlighting, schema-based validation when configured, and hover help for many Kubernetes resources if you associate schemas or use the Kubernetes extension below.

Kubernetes (Microsoft)

Extension ID: ms-kubernetes-tools.vscode-kubernetes-tools. Snippets for resources, navigation between manifests, and cluster integration. Pairs well with the YAML extension for fewer “mystery indent” mistakes.

Editor habits that prevent pain

Online YAML validators (paste with care)

Never paste manifests that contain real credentials, live tokens, or production Secret data into third-party websites. Use scrubbed examples or lab-only values.

Use these when the error says error converting YAML to JSON—that usually means the file is not valid YAML yet, before Kubernetes even checks resource fields.

Validate with kubectl (best signal for K8s YAML)

Client dry-run (fast, offline-friendly)

kubectl apply --dry-run=client -o yaml -f your-manifest.yaml

Checks that kubectl can parse the file and build the object. Does not talk to admission webhooks.

Server dry-run (stronger checks)

kubectl apply --dry-run=server -f your-manifest.yaml

Requires a cluster connection. Catches more validation, including some policy and admission issues.

See what would change

kubectl diff -f your-manifest.yaml

Compares your file to live objects—great after hand-editing exported YAML.

Schema discovery

kubectl explain deployment.spec.template.spec.containers --recursive

Troubleshooting matrix

Error or symptomLikely causeFix
found character that cannot start any tokenTab character or stray character in column 1Replace tabs with spaces; show invisible characters in the editor.
did not find expected keyList item or child key mis-indentedAlign - list markers; ensure name: under a container is deeper than -.
mapping values are not allowed hereMissing newline after : or broken flowPut value on same line or indent block correctly on next line.
unknown field in Pod specField belongs under Deployment templateMove under spec.template.spec for workload templates.
Service has no EndpointsSelector labels mismatch Pod labelsCompare spec.selector to metadata.labels on Pods.
Resource unchanged but behavior wrongEdited file but applied wrong pathConfirm kubectl apply -f path; use kubectl diff.

Lab-safe recovery loop

  1. Read the full error message (line/column if given).
  2. Fix YAML structure first; then fix Kubernetes field names.
  3. Run kubectl apply --dry-run=client -f ....
  4. Apply for real; use kubectl describe / logs for runtime issues.
  5. If stuck, revert the file from git and re-apply a known-good manifest.

Series complete

You now have syntax (Part 1), object patterns and editing (Part 2), and tooling plus troubleshooting (Part 3).