How to fix MountVolume.SetUp failed for volume "config": configmaps "app-config" not found in Kubernetes

KubernetesBEGINNERHIGHUpdated Dec 6, 2025· 210 views

A pod references a ConfigMap that doesn't exist or is in a different namespace. ConfigMaps are namespace-scoped; pods can only access ConfigMaps in their own namespace. Fix by creating the ConfigMap in the correct namespace or marking the reference as optional to allow pod startup.

Quick fix

Fixes MountVolume.SetUp failed for volume "config": configmaps "app-config" not found

kubectl get configmap -n <pod-namespace>
kubectl describe configmap <configmap-name> -n <pod-namespace>
  1. Verify ConfigMap exists in pod's namespace
  2. Check the pod spec for ConfigMap reference
  3. Create the missing ConfigMap in the correct namespace
  4. If ConfigMap is in different namespace, copy or move it
kubernetes — error
kubectl get configmap -n <pod-namespace>
kubectl describe configmap <configmap-name> -n <pod-namespace>
MountVolume.SetUp failed for volume "config": configmaps "app-config" not found

What this error means

ConfigMaps are Kubernetes configuration objects that store non-sensitive configuration data as key-value pairs. When a pod spec references a ConfigMap for environment variables or volume mounts, Kubernetes expects to find that ConfigMap in the pod's namespace. ConfigMaps are namespace-scoped resources—there is no built-in cross-namespace access mechanism. If the ConfigMap doesn't exist or is in a different namespace, the kubelet cannot mount the config volume or inject the environment variables. The error blocks pod startup entirely unless the ConfigMap reference is marked as optional.

Typical symptoms

  • Pod remains in Pending or ContainerCreating state
  • kubectl describe pod shows "MountVolume.SetUp failed for volume...configmaps...not found"
  • Container fails to start with CreateContainerConfigError
  • Pod logs show "ConfigMap "app-config" not found"
  • ConfigMap-based environment variables are not injected
  • ConfigMap volume mount fails with permission errors or missing mount path
  • Multiple pod restart attempts with consistent failures

Common causes

  1. ConfigMap has not been created before pod deployment
  2. ConfigMap exists in different namespace than pod
  3. Typo or case mismatch in ConfigMap name in pod spec
  4. ConfigMap was deleted while pod still references it
  5. Volume name mismatch between volumes and volumeMounts sections
  6. ConfigMap key doesn't exist in the data (when referencing specific keys)
  7. Mounting ConfigMap to root directory overwriting essential container files

How to fix "MountVolume.SetUp failed for volume "config": configmaps "app-config" not found"

1Verify ConfigMap exists in pod's namespace

List all ConfigMaps in the namespace:

bash
kubectl get configmap -n <pod-namespace>
kubectl describe configmap <configmap-name> -n <pod-namespace>

The ConfigMap name and namespace must match exactly. If missing, move to the next step.

2Check the pod spec for ConfigMap reference

Examine how the pod references the ConfigMap:

bash
kubectl get pod <pod-name> -n <pod-namespace> -o yaml | grep -A10 configMap

Look for:
- volumeMounts[].name and volumes[].configMap.name (for config volumes)
- env[].valueFrom.configMapKeyRef.name (for environment variables)
- envFrom[].configMapRef.name (for bulk env import)

Verify the referenced ConfigMap name matches exactly (case-sensitive).

3Create the missing ConfigMap in the correct namespace

Create the ConfigMap using YAML or kubectl:

Using kubectl with individual values:

bash
kubectl create configmap app-config \
  --from-literal=DATABASE_HOST=localhost \
  --from-literal=DATABASE_PORT=5432 \
  --from-literal=APP_ENV=production \
  -n <pod-namespace>

Using kubectl from a file:

bash
kubectl create configmap app-config \
  --from-file=config.properties \
  -n <pod-namespace>

Using YAML manifest:

yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: app-config
  namespace: production
data:
  DATABASE_HOST: localhost
  DATABASE_PORT: "5432"
  APP_ENV: production
  config.ini: |
    [database]
    host=localhost
    port=5432

Apply the manifest:

bash
kubectl apply -f configmap.yaml

Verify creation:

bash
kubectl get configmap -n <pod-namespace>
kubectl describe configmap app-config -n <pod-namespace>
4If ConfigMap is in different namespace, copy or move it

ConfigMaps cannot be referenced across namespaces. You must either copy or move it:

Copy to pod's namespace:

bash
kubectl get configmap <name> -n <source-namespace> -o yaml | \
  sed 's/namespace: <source-namespace>/namespace: <pod-namespace>/' | \
  kubectl apply -f -

Verify:

bash
kubectl get configmap -n <pod-namespace>

Alternative: Move pod to ConfigMap's namespace (if appropriate)

Edit the pod namespace in its manifest and redeploy.

5Verify pod can now access the ConfigMap

After creating the ConfigMap, the pod should start automatically:

bash
kubectl get pod <pod-name> -n <pod-namespace>
kubectl describe pod <pod-name> -n <pod-namespace>

Pod status should transition from Pending to Running. Check logs:

bash
kubectl logs <pod-name> -n <pod-namespace>

Verify ConfigMap environment variables were injected:

bash
kubectl exec <pod-name> -n <pod-namespace> -- env | grep -i config
6Mark ConfigMap reference as optional if appropriate

If ConfigMap is optional (not critical for startup), mark it as optional to allow pod startup even if ConfigMap is missing:

For environment variables:

yaml
env:
- name: CONFIG_SETTING
  valueFrom:
    configMapKeyRef:
      name: app-config
      key: config-setting
      optional: true  # Pod starts even if ConfigMap or key is missing

For bulk import:

yaml
envFrom:
- configMapRef:
    name: app-config
    optional: true

For volume mounts:

yaml
volumes:
- name: config
  configMap:
    name: app-config
    optional: true  # Mount proceeds even if ConfigMap is missing

When optional is true, the pod starts without the ConfigMap data. Environment variables won't be set, and volume mount paths may be empty.

7Check volume mount and environment variable names

Ensure ConfigMap keys match what the application expects:

View ConfigMap keys:

bash
kubectl get configmap app-config -n <pod-namespace> -o yaml

Verify environment variable names:

bash
kubectl exec <pod-name> -n <pod-namespace> -- env | sort

Check volume mount:

bash
kubectl exec <pod-name> -n <pod-namespace> -- ls -la /etc/config/

If using envFrom, invalid environment variable names (e.g., with hyphens or spaces) are silently skipped. Check pod events:

bash
kubectl describe pod <pod-name> -n <pod-namespace> | grep -A5 Events

Advanced notes

ConfigMaps have a 1 MiB size limit; use external configuration management (Consul, etcd, git-based tools like Flux) for larger configs. Immutable ConfigMaps (immutable: true) cannot be updated once created; deploy new ConfigMap versions and update pod references in your manifests. Volume mount behavior: if mounting ConfigMap to a directory containing application files, those files are hidden/inaccessible (replaced by ConfigMap content). Mount to subdirectories instead (e.g., /etc/config/). For binary or non-string config, use binary fields or store as base64 in stringData. kubelet caches ConfigMaps; updates take 10+ seconds to propagate to pods (depending on kubelet sync period). For immediate config reloads without pod restart, use a sidecar container that watches ConfigMap changes and reloads the application. YAML indentation matters for multi-line config values; test with dry-run before applying. Size considerations: 10,000+ keys in a single ConfigMap may cause performance issues; split into multiple ConfigMaps if needed.

Frequently asked questions

What does "MountVolume.SetUp failed for volume "config": configmaps "app-config"" mean?
ConfigMaps are Kubernetes configuration objects that store non-sensitive configuration data as key-value pairs. When a pod spec references a ConfigMap for environment variables or volume mounts, Kubernetes expects to find that ConfigMap in the pod's namespace. ConfigMaps are namespace-scoped resources—there is no built-in cross-namespace access mechanism.
How do I fix "MountVolume.SetUp failed for volume "config": configmaps "app-config""?
A pod references a ConfigMap that doesn't exist or is in a different namespace. ConfigMaps are namespace-scoped; pods can only access ConfigMaps in their own namespace. Fix by creating the ConfigMap in the correct namespace or marking the reference as optional to allow pod startup.
What causes "MountVolume.SetUp failed for volume "config": configmaps "app-config""?
ConfigMap has not been created before pod deployment ConfigMap exists in different namespace than pod Typo or case mismatch in ConfigMap name in pod spec
Is the "MountVolume.SetUp failed for volume "config": configmaps "app-config"" error serious?
Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.

Official resources & further reading