Skip to content
Novus Examples
yaml691 B

Kubernetes Manifest, Intentionally Invalid

An intentionally invalid Kubernetes manifest: a removed apiVersion, a quoted string where replicas needs an integer, a selector that does not match the pod template, and containers as a mapping instead of a list. Four documented faults for a validator to report.

Preview — first 24 linesyaml
# INTENTIONALLY INVALID. Well-formed YAML, invalid Kubernetes in four documented ways:
#   1. `apiVersion: apps/v1beta1` was removed in Kubernetes 1.16
#   2. `replicas` is a quoted string where an integer is required
#   3. `spec.selector` does not match the pod template labels
#   4. `containers` is a mapping where a list is required
apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: broken
  namespace: example-apps
spec:
  replicas: "three"
  selector:
    matchLabels:
      app: not-the-template-label
  template:
    metadata:
      labels:
        app: broken
    spec:
      containers:
        name: app
        image: registry.example.invalid/example-org/broken:0.1.0

Specifications

Variant
intentionally invalid
Yaml Well Formed
true
Violations
4
Removed Api Version
apps/v1beta1

Testing contract

Expected to fail
Scenario
Validate a well-formed YAML manifest against the Kubernetes API schema
Expected result
Validation fails with at least 4 errors, and the removed apps/v1beta1 apiVersion is reported separately from the selector/template label mismatch

What is a .yaml file?

YAML (YAML Ain't Markup Language) is a human-readable data-serialization format using indentation, key-value pairs, and lists, and is a superset of JSON. It supports comments, anchors, and multiple documents per file, favoring readability for configuration. Its indentation sensitivity makes it error-prone to hand-edit.

How to use this file

Use an example YAML file to test config parsers, indentation and anchor handling, multi-document streams, and safe-loading to avoid arbitrary object construction.

How to use this file for testing

“Kubernetes Manifest, Intentionally Invalid” is a deterministic Novus Examples fixture for Error handling, Config parsing, Schema validation. Deliberately corrupt and invalid files, clearly labelled, for testing how your tool fails.

Documented properties for this file: YAML · 691 bytes. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

Pipeline and infrastructure fixtures are inert configuration: steps reference fictional images and scripts, and nothing here executes. Run your linter, schema validator, migrator, or policy engine against them, and expect the deprecated-syntax and intentionally invalid variants to be rejected.

Code examples

import yaml  # pip install pyyaml

with open("invalid-apiversion.yaml") as f:
    data = yaml.safe_load(f)
print(data)

Generated by generation/pipelines.py. Free for any use, no attribution required — license.