I’ve been auditing AI-generated Kubernetes manifests for clients, and I keep finding the same problem: LLMs confidently generate YAML fields that don’t exist.
The Problem
AI coding assistants generate Kubernetes manifests that:
- Look syntactically correct
- Pass basic YAML linting
- Use plausible-sounding API fields
- Fail silently or cause unexpected behavior in production
Real Examples I’ve Found
Example 1: Invented field names
spec:
containers:
- name: app
resources:
guaranteedMemory: "512Mi" # Not a real field
The actual fields are requests and limits. The AI invented guaranteedMemory because it sounds reasonable. Kubernetes ignores unknown fields in many contexts — no error, just no memory guarantee.
Example 2: Wrong API version features
apiVersion: apps/v1
kind: Deployment
spec:
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
pauseSeconds: 30 # Not a real field in apps/v1
The AI combined knowledge from different API versions or related projects. pauseSeconds isn’t a thing, but it sounds like it should be.
Example 3: Plausible security settings
spec:
securityContext:
enforceSELinux: true # Not a real field
auditMode: strict # Not a real field
These sound like security best practices. An engineer who doesn’t know the exact SecurityContext schema might accept them. The cluster accepts them (and ignores them).
Why This Is Dangerous
1. Silent failures:
Kubernetes often ignores unknown fields rather than rejecting them. Your “security hardening” might be doing nothing.
2. False confidence:
You think you configured something correctly. Tests pass (because the field is ignored). Production behaves unexpectedly.
3. Non-deterministic validation:
The same AI might generate different fields for the same request. You can’t rely on consistency.
The Validation Gap
Traditional validation catches:
- Syntax errors
- Type mismatches
- Required field missing
Traditional validation misses:
- Unknown fields (often silently accepted)
- Semantically wrong values
- Fields that exist but don’t do what you think
What I Recommend
- Strict schema validation - Use
kubectl --dry-run=serveror similar to validate against the actual cluster API - Schema-aware linting - Tools like Kubeconform or Datree that know the real API schema
- Human review of AI-generated infra - Don’t trust the AI more than you’d trust a junior engineer
- Test in staging first - Obvious, but critical when you can’t fully trust your manifests
Questions for Platform Engineers
- How do you validate AI-generated Kubernetes configs?
- Have you encountered “invented field” issues in production?
- What tooling helps catch these problems?