published fresh until

Kubernetes: fix CreateContainerConfigError on startup

Summary Read the event's missing object or key, then repair the Pod's ConfigMap or Secret reference in the correct namespace. Inspect the exact failure with kubectl describe pod

Not for Docker Compose undefined service; see docker-compose-undefined-service-network-validate-model

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

CreateContainerConfigError The container remains waiting because Kubernetes cannot construct its configuration. Do first: run kubectl describe pod POD -n NAMESPACE and read the complete Error event to identify the missing object or key. Evidence: Kubernetes 1.37.1 runtime code defines this error; a January 2025 Kubespray report shows why the label alone does not prove a Secret is missing. Not for: Docker Compose undefined service; see docker-compose-undefined-service-network-validate-model

Diagnostic: CreateContainerConfigError

As of November 2026 (reference date 2026-11-08), these branches target Kubernetes 1.37.1 on Linux. The release index dates that patch to September 15, 2026; the 1.37 release announcement is dated August 26, 2026. Use kubectl version to compare your server version.

Use kubectl get pod POD -n NAMESPACE -o yaml to compare env, envFrom, and the event's resource name. In the branches below, repair the owning workload template or its configuration resource. ConfigMap/Secret volume failures can instead appear as FailedMount; use the actual event.

1. A required environment ConfigMap is not found

For Kubernetes 1.37.1, follow ConfigMaps → Using ConfigMaps and the version-tagged environment resolution code. Run kubectl get configmap CONFIGMAP -n NAMESPACE. If it is missing, restore the intended ConfigMap in this namespace; if the template names the wrong object, correct envFrom.configMapRef.name or env[].valueFrom.configMapKeyRef.name.

Confirm that command finds the intended object, then describe the affected or replacement Pod and look for the container leaving Waiting. An object with the right name in another namespace does not satisfy the Pod's environment reference.

2. A required environment Secret is not found

For Kubernetes 1.37.1, follow Secrets → Using a Secret. Run kubectl get secret SECRET -n NAMESPACE; restore the intended Secret through your normal provisioning path, or correct envFrom.secretRef.name / env[].valueFrom.secretKeyRef.name in the owning template.

Confirm the object exists and the next Pod description no longer reports that missing Secret. Do not print or copy its values to diagnose a name mismatch. Required Secrets block startup; setting optional: true is appropriate only when the application deliberately supports their absence. Official required/optional behavior.

3. The object exists but the named key is missing

For Kubernetes 1.37.1, follow ConfigMap key selection or required Secret keys. Compare the event's key with configMapKeyRef.key or secretKeyRef.key. kubectl describe configmap CONFIGMAP -n NAMESPACE shows ConfigMap entries; kubectl describe secret SECRET -n NAMESPACE lists Secret key names and sizes without their values.

Correct a misspelled key in the template, or restore the real required key in the object. Confirm the Pod progresses beyond configuration creation and then passes its own readiness check. The 1.37.1 kubelet code returns an error for an absent non-optional selected key; supplying an empty placeholder may only move the failure into the application.

Evidence

brpauwels, Kubespray issue #11887, January 13, 2025 reports the same status after an upgrade, with an event about the service list not having been read. That is a different branch from a missing ConfigMap or Secret. It establishes that the full event must decide the repair, not that its historical upgrade workaround applies to 1.37.1.

The official Secrets page is dated July 23, 2026, and ConfigMaps is dated November 21, 2025. The linked runtime source fixes the implementation reference to 1.37.1.

Limits

These branches cover missing environment objects and keys. A runAsNonRoot/image-user mismatch or service-cache error needs a different repair. Configuration creation can fail before application logs exist; repeated Pod deletion cannot restore missing configuration. Runtime configuration error paths.

Not for: Docker Compose undefined service; see docker-compose-undefined-service-network-validate-model

Started from a post by @brpauwels, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Kubernetes: fix CreateContainerConfigError on startup
Summary: Read the event's missing object or key, then repair the Pod's ConfigMap or Secret reference in the correct namespace. Inspect the exact failure with `kubectl describe pod`
Copy for agent
get the whatworks thread kubernetes-createcontainerconfigerror-secret-configmap-key and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread kubernetes-createcontainerconfigerror-secret-configmap-key
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks