YAML Linter for Kubernetes Manifests – Catch Errors Before kubectl Apply
Paste your manifest and get errors with exact line numbers
No signup • Runs in browser • Free
kubectl apply fails because manifests mix tabs and spaces or are missing apiVersion values. The error message — something like mapping values are not allowed here — does not tell you which line. You scan the manifest manually, find nothing obvious, and several minutes later discover a tab character that no text editor displays by default. A YAML linter surfaces these issues instantly with the exact line number.
Kubernetes YAML is particularly unforgiving. The spec is strict about indentation depth, key structure, and field names. A single misaligned block under spec can cause kubectl apply to fail with a vague parsing error that gives you almost nothing to work with. Running the manifest through a linter before applying it to any cluster takes ten seconds and eliminates the entire class of whitespace-related failure.
# Common errors that break kubectl apply:
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 3
template:
spec:
containers: # ← 8 spaces instead of 6 — indentation drift
- name: app
image: nginx:1.25 # ← tab character before "image" — breaks YAML parsing
env:
- name: ENV_VAR # ← should be under containers item, not spec
Quick summary
- ✓Kubernetes YAML errors produce vague messages — a linter pinpoints the exact line.
- ✓Tab characters are the most common cause of 'mapping values are not allowed here'.
- ✓Linting before applying is faster than debugging a failed kubectl apply.
- ✓DevToolBox tools run entirely in your browser — no signup.
What It Is
A YAML linter parses your manifest against the YAML specification and reports structural errors with line numbers. It detects tab characters, inconsistent indentation, missing colons, unquoted special characters, and other issues that cause parsers to reject the file.
For Kubernetes manifests specifically, the linter validates that the YAML is structurally sound before you apply it. It does not check Kubernetes-specific semantics (whether a field name is valid for a given resource type) — but it catches the class of error that causes the YAML parser to fail before Kubernetes ever sees the content.
Why Developers Use This
- Pre-apply validation. Running a linter before
kubectl applycatches whitespace errors that would otherwise produce cryptic failure messages in the cluster. See our guide on YAML validation online for a full overview of YAML syntax rules. - Working with generated manifests. Helm renders templates into YAML. If a values file contains anchors or overrides that collapse indentation, the rendered output can be structurally invalid. Linting the rendered YAML before applying it confirms the output is clean.
- Onboarding YAML edits from non-specialists. When developers who rarely work with Kubernetes YAML make changes to manifests, running the file through a linter first is a quick sanity check before a PR review.
- Editor-agnostic enforcement. Different editors handle whitespace differently. A linter gives you a consistent, editor-independent check that works the same way for every team member.
Common YAML Errors in Kubernetes Manifests
- Indentation drift. A block indented by four spaces instead of two misaligns the nesting under
spec. The errormapping values are not allowed heretypically means a key is indented at the wrong level relative to its parent. - Tab characters. A single tab in a manifest yields
found character '\t' that cannot start any token. YAML explicitly forbids tabs for indentation — configure your editor to show invisible characters and convert tabs to spaces automatically. - Missing colons.
env VARinstead ofenv: VARis treated as a plain string, not a key-value pair. This stops the manifest from being parsed and is easily missed when editing under time pressure.
How to Use the YAML Linter
Using the DevToolBox YAML Linter to validate a Kubernetes manifest takes under a minute.
- Open the linter in your browser. No account, no install.
- Paste your Kubernetes manifest — Deployment, Service, ConfigMap, or any other resource type.
- Click Lint & Format. The tool parses the YAML and either reports errors with line numbers, or returns a cleanly formatted version.
- If errors are listed, each one includes a line number so you can jump directly to the problem. Fix the issue in your original manifest and paste again.
- Once the linter reports no errors, apply the validated manifest with confidence.
DevToolBox tools run entirely in your browser — nothing you paste is transmitted to any server. You can safely lint manifests containing internal hostnames, image registry credentials, or environment-specific values.
Frequently Asked Questions
Does the linter understand Kubernetes-specific field names?
The linter validates YAML syntax and structure. For schema-specific validation — checking that field names are valid for a given Kubernetes resource type — you would also need a tool like kubeval or kubeconform. Syntax errors are always caught first, though: a schema validator cannot run on invalid YAML.
How do I keep indentation consistent across a team?
Configure your editor to use spaces only (never tabs) and set the YAML indentation to 2 spaces. Add an .editorconfig file to the repository to enforce this for every editor automatically. The linter then serves as a final check before commit.
Can I run YAML linting in a pre-commit hook?
Yes. Add a YAML lint step to your .pre-commit-config.yaml — tools like yamllint or prettier --check work well for this. The online linter is useful for quick manual checks; the pre-commit hook handles automated enforcement.
Conclusion
Kubernetes manifest errors are cheap to fix before apply and expensive to debug after. Linting the YAML locally surfaces structural issues before the cluster ever sees them — saving the round-trip through kubectl, the error message parsing, and the manual line-by-line scan that follows.
If you need a fast YAML linter that catches tab characters, indentation drift, and colon errors with exact line numbers, DevToolBox does exactly that. DevToolBox tools run entirely in your browser — no signup, no install, nothing sent to a server.
Lint your Kubernetes manifests in seconds
Paste any YAML manifest — get errors by line number and a cleanly formatted copy. Free, no signup, browser-only.
Lint Kubernetes YAML →