On this page
The short answerWhat goes stale in a manifest exampleValidate each manifest against its target versionScan for removed APIsDry-run against the APIApply to a throwaway clusterCheck the commands and flagsKeep credentials out of the runRun it on every changeChecklist for a Kubernetes manifest testWhere DocsAlive fitsWhat this does not replaceThe sources we checkedFAQKubernetes examples age fast. An apiVersion that worked two releases ago may be removed in the version your reader runs, and the manifest in the docs still parses as YAML. The API server is what rejects it, at apply time, in front of the reader. This guide covers how to test manifest examples against the versions they claim to support, before a reader has to.
The short answer
Extract each manifest from the docs exactly as published — do not clean it up first. Validate it against the schemas of the Kubernetes version the docs target, not just the newest one. Scan for deprecated and removed APIs explicitly, because a manifest can be schema-valid for one version and impossible on the next. Then apply it to a throwaway cluster and watch the rollout reach the state the docs promise. Record the tool versions and the target version with every result, because a manifest test without a version is a result nobody can reproduce.
DocsAlive does not validate manifests against a cluster. It runs the code samples in your Markdown docs — the kubectl commands and shell sequences around the YAML — in a fresh container, and reports the ones that break. The manifest checks on this page stay with your Kubernetes tooling; the config examples guide covers the wider problem of testing configuration that docs ask readers to copy.
What goes stale in a manifest example
- Removed APIs: a beta
apiVersionis removed in a later Kubernetes release, and the example fails at apply time. - Changed fields: a field is renamed or moved between versions of the same resource.
- Images and tags: the example's container image tag no longer exists or now points at a different build.
- Commands: a
kubectlflag in the surrounding steps is deprecated or removed.
Removals are the sharpest failure because they are scheduled. Kubernetes announces them in its Deprecated API Migration Guide, and the removals that catch documentation most often are these:
| API | Removed in | Use instead |
|---|---|---|
| Ingress extensions/v1beta1 and networking.k8s.io/v1beta1 | 1.22 | networking.k8s.io/v1 |
| CronJob batch/v1beta1 | 1.25 | batch/v1 |
| PodDisruptionBudget policy/v1beta1 | 1.25 | policy/v1 |
| PodSecurityPolicy policy/v1beta1 | 1.25 | No replacement API — Pod Security Admission |
| HorizontalPodAutoscaler autoscaling/v2beta1 | 1.25 | autoscaling/v2 |
| HorizontalPodAutoscaler autoscaling/v2beta2 | 1.26 | autoscaling/v2 |
A version bump is not always a rename. The Ingress migration to networking.k8s.io/v1 also changed the shape: spec.backend became spec.defaultBackend, serviceName and servicePort became service.name and service.port, and every path needs a pathType. An example updated by changing only the apiVersion line still fails. Behaviour can change under the same fields, too: an empty spec.selector on a PodDisruptionBudget selects no pods in policy/v1beta1 and all pods in the namespace in policy/v1 — a manifest that applies cleanly on both versions and means different things.
Validate each manifest against its target version
- Extract each manifest from the docs exactly as shown.
- Validate it with a schema validator against the target version, for example
kubeconform -kubernetes-version 1.30 -strict -summary manifest.yaml - Record any field the validator rejects, with the manifest's location in the docs.
kubeconform -kubernetes-version 1.30 -strict -summary docs/examples/*.yaml
kubeconform validates resources against the published Kubernetes JSON schemas. The flags that matter for docs work: -kubernetes-version pins the schema set to the version the docs target, so a field removed in that version fails here instead of on a reader's cluster; -strict rejects fields the schema does not define, which is how misspelled or long-removed fields surface; -summary prints counts instead of one line per valid file. Two cautions. Custom resources need their schemas supplied with -schema-location, or skipped deliberately with -skip — silently skipping a kind is how a broken CRD example passes. And -ignore-missing-schemas should be a recorded decision, never a default: it tells the validator to pass what it cannot check.
Validate against every version the docs claim to support, not only the newest. A manifest can be valid for 1.30 and invalid for 1.28 if it uses a field added in between, and the reverse — valid on the old version, removed on the new — is the failure this guide exists to catch. If the docs state a minimum version, that version is part of the test matrix.
Scan for removed APIs
Schema validation answers "is this manifest well-formed for version X." A deprecation scan answers the docs question directly: "does this example use an API that is deprecated or already removed, and what replaces it?" Pluto, from Fairwinds, scans files and Helm charts for exactly that:
pluto detect-files -d docs/examples/
Each finding names the resource, the version it uses, the replacement, and whether that version is deprecated or removed. Pluto exits with a non-zero status when it finds deprecated or removed APIs, which makes it usable as a CI gate rather than a report nobody reads. Its detect-helm mode does the same for releases already installed in a cluster, which is useful when the docs ship a chart rather than raw manifests.
Run both tools. kubeconform with -strict catches misspelled and unknown fields that a deprecation scan ignores; Pluto catches a perfectly well-formed manifest whose API is scheduled for removal, which schema validation against today's version also passes. Between them they cover the two ways an example dies: it was never right for the target version, or the target version moved.
Dry-run against the API
A schema validator works offline. The API server is the second opinion, and kubectl offers two levels of it:
kubectl apply --dry-run=client -f manifest.yaml
kubectl apply --dry-run=server -f manifest.yaml
A client dry run checks the manifest locally. A server dry run sends it to the API server, which runs the same admission and validation the real apply would — including defaulting and the checks for APIs the cluster no longer serves — without persisting anything. A manifest written for a removed API fails the server dry run against a current cluster even though it is valid YAML and was valid documentation two releases ago. Add --validate behaviour deliberately: kubectl's own client-side schema validation can be pointed at the cluster's schemas or turned off, and a test record should say which setting was used.
Mind the version pairing while you do this. kubectl is supported within one minor version of the API server, in either direction. A test run with a much newer or older kubectl can fail — or pass — for reasons that have nothing to do with the manifest, so record both versions with the result.
Apply to a throwaway cluster
- Create a throwaway cluster, for example with kind or minikube.
- Apply the manifest unchanged, for example
kubectl apply -f manifest.yaml - Check the resource reaches the state the docs describe, for example
kubectl rollout status deployment/example - Delete the cluster after the check.
kind create cluster --name docs-test
kubectl apply -f manifest.yaml
kubectl rollout status deployment/example
kind delete cluster --name docs-test
Applying is the only step that tests the whole example: the image pulls, the container starts with the documented command and environment, probes pass, and any referenced ConfigMap, Secret or Service in the same example exists. Before applying an updated example over an old one, kubectl diff -f manifest.yaml shows what would change — the fastest way to see that a "small docs fix" also renames a resource or changes a selector, which in a real cluster means a replaced workload, not an edited one.
Check the state the docs promise, not just a successful apply. kubectl apply succeeding means the API accepted the objects. If the guide says the pod becomes ready and serves traffic, watch the rollout and then ask the service the documented question. A crash-looping pod behind a successfully applied Deployment is a docs failure the apply step alone reports as green.
Check the commands and flags
Docs usually wrap a manifest in commands: apply it, check the rollout, fetch logs, port-forward to try it. Test those commands with the manifest, because a removed flag in the prose breaks the example even when the YAML is current. Check each flag against the help output of the kubectl version the docs target — kubectl apply --help is the reference, not memory — and prefer the long-lived forms in examples. Where a step needs output in a specific shape, such as a jsonpath expression copied from the resource's status, run it against the applied resource: field paths in status objects change between versions just as spec fields do.
Keep credentials out of the run
Use a local throwaway cluster for examples, not a shared staging cluster. If an example needs a Secret, create a dummy value for the test and do not copy a real credential into the manifest. Manifest examples that print a real-looking token or a base64 blob readers mistake for a real Secret teach a habit you do not want your docs teaching; base64 is an encoding, not protection, and a committed example Secret tends to be copied into real clusters unchanged.
Clean up after the run. A throwaway cluster that is never deleted stops being throwaway, and its kubeconfig tends to spread. Keep the test kubeconfig separate from any real one, and make the delete step part of the script rather than a manual habit, so a failed run still cleans up.
Run it on every change
- Pull requests that touch docs or manifests: validate and apply the affected examples.
- Releases: run the full set against the release's target versions.
- Nightly: run against the newest Kubernetes version, so removals surface before readers upgrade.
A minimal CI outline:
# 1. Schema validation against the documented target version
kubeconform -kubernetes-version 1.30 -strict -summary docs/examples/*.yaml
# 2. Deprecation and removal scan (non-zero exit on findings)
pluto detect-files -d docs/examples/
# 3. Apply to a throwaway cluster and watch the rollout
kind create cluster --name docs-test
kubectl apply -f docs/examples/
kubectl rollout status deployment/example
kind delete cluster --name docs-test
When a new Kubernetes release lands, add its version to the matrix before announcing support for it, and run the removal scan with that release as the target. The Deprecated API Migration Guide publishes the schedule well ahead of each removal — the nightly run exists so your docs meet the schedule on your timing instead of a reader's.
Checklist for a Kubernetes manifest test
| Check | Evidence to retain |
|---|---|
| Manifest extracted unchanged | Source page and block the manifest was taken from |
| Schema validation passes per target version | Validator, version matrix and strict-mode result |
| No deprecated or removed APIs | Pluto output, including the replacement for each finding |
| Server dry run passes | Cluster and kubectl versions the dry run ran against |
| Applied to a throwaway cluster | Rollout status and the documented end state observed |
| Surrounding commands run as written | kubectl version each flag was checked against |
| No real credentials in examples | Dummy values used; test cluster and kubeconfig deleted |
| Images in the example resolve | Tags pulled during the apply run, recorded with the result |
Where DocsAlive fits
DocsAlive runs the code samples in your docs in an isolated container on each release and nightly, separates likely docs bugs from expected failures, and can draft the fix for your team to review. On a Kubernetes guide, that covers the shell sequence the reader follows — the commands around the manifest, in order, in a clean environment — which is where stale flags, renamed files and missing setup steps surface.
For a starting point, the free health check lets you send a public repository you own or maintain; the team runs the engine on up to 40 of its docs pages and emails the real report within 2 business days; the checkout is deleted after the run. Pricing is Open source $0/month, Team $299/month, Growth $699/month, and Scale from $1,499/month.
What this does not replace
DocsAlive does not validate manifests against your cluster's schemas, scan for removed APIs, or replace kubeconform, Pluto and a throwaway-cluster apply. Keep those for the manifests themselves. A manifest that applies also does not prove the workload is well run — resource limits, security context and upgrade safety are separate reviews — and it does not prove the prose around the manifest explains it correctly.
The sources we checked
| Source | What it covers |
|---|---|
| Kubernetes Deprecated API Migration Guide | Removed APIs, the versions they were removed in, and their replacements |
| kubeconform documentation | Schema validation flags: version pinning, strict mode, schema locations |
| Pluto documentation | detect-files and detect-helm modes and CI exit behaviour |
| kubectl reference | Apply dry runs, diff, rollout status and version skew with the API server |
| kind documentation | Creating and deleting throwaway local clusters |
FAQ
The manifest is valid YAML. Why does the cluster reject it?
Because YAML validity is only syntax. The API server rejects APIs it no longer serves and fields its schemas do not define. A manifest for an API removed in 1.25 is perfect YAML and an error on a 1.25 cluster — which is why validation has to name a target version.
Is schema validation enough on its own?
No. It proves the manifest matches a version's schemas. It does not scan for deprecations on their own schedule, and it does not prove the workload runs. Pair it with a removal scan and a throwaway-cluster apply.
Which versions should the examples be tested against?
Every version the docs claim to support, including the stated minimum. Fields are added as well as removed, so the newest version passing says nothing about the oldest.
Does DocsAlive validate manifests?
No. It runs the code samples in your Markdown docs and reports the blocks that break. Manifest validation, removal scanning and cluster testing stay with kubeconform, Pluto and kubectl.
How often should manifest examples be retested?
On pull requests that touch them, in full at release, and nightly against the newest Kubernetes version — removals land on the Kubernetes schedule, not on your docs schedule.




