unknown field ☸️ Kubernetes

strict decoding error: unknown field "spec.template.spec.containers[0].ports[0].protocl"

The manifest contains a field the API schema doesn’t know — a typo, wrong indentation, or a field from another API version.

Seen on: Kubernetes

Meaning

Since Kubernetes 1.25 server-side field validation rejects unknown fields (older clients said “error validating data: ValidationError … unknown field”). Most often a key is indented one level too deep or shallow, so it lands in the wrong object.

Common causes

  • Typo in a key name
  • Wrong indentation putting a key under the wrong parent
  • Field from a newer/older API version
  • Helm template rendering a value at the wrong level

⚡ Quick fix

  1. Check the field path in the message
  2. kubectl explain <kind>.<path> to see valid fields
  3. Validate locally with kubectl apply --dry-run=server

Detailed fix by platform

Kubernetes

  1. bash
    kubectl explain deployment.spec.template.spec.containers.ports
    kubectl apply --dry-run=server -f deploy.yaml

How to diagnose

  1. Path — Exact field path reported
  2. Indentation — Parent key in the YAML
  3. Version — apiVersion in use

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.