QA
Intermediate LevelDocker & Deployment

How do you hot-reload application configurations when ConfigMaps update?

❓ Interview Prompt: Explain ConfigMap volume projection file updates, propagation delay, and tools like Reloader for automatic pod restarts on ConfigMap changes.

When a ConfigMap is updated, pods consuming it via volume mounts eventually receive the updated files — but the propagation is not instant and the application must support file-watching to use the new config.

ConfigMap Update Propagation:

•
Volume-mounted ConfigMaps: Updated by kubelet within ~1 minute (configurable via --sync-frequency). The files in the mounted directory are atomically replaced using symlinks.
•
Environment variable ConfigMaps: NOT updated after pod creation. Pod must restart to pick up new env values.

Application File-Watching (Native Reload):

Applications using config file watching (e.g., NGINX, Prometheus, Node.js with chokidar) can pick up changes without pod restarts. However, most applications require a process restart to reload config.

Reloader (Stakater):

Reloader is a Kubernetes controller that watches ConfigMaps and Secrets and automatically performs rolling restarts on Deployments/StatefulSets when those objects change.

Simply add an annotation to your Deployment — Reloader handles the rest.

Code Implementation Example

yaml
# ConfigMap with application config
apiVersion: v1
kind: ConfigMap
metadata:
  name: api-config
data:
  app.json: |
    {
      "logLevel": "info",
      "featureFlags": {
        "newCheckout": true
      }
    }
---
# Deployment with Reloader annotation
apiVersion: apps/v1
kind: Deployment
metadata:
  name: api
  annotations:
    # Reloader watches this ConfigMap and restarts pods on change
    reloader.stakater.com/auto: "true"
    # OR specify exact ConfigMaps to watch:
    # configmap.reloader.stakater.com/reload: "api-config,api-secrets"
spec:
  template:
    spec:
      containers:
        - name: api
          image: myapp:v1.2.3
          # Mount ConfigMap as volume — receives file updates
          volumeMounts:
            - name: config
              mountPath: /app/config
              readOnly: true
      volumes:
        - name: config
          configMap:
            name: api-config
💡Reloader annotation triggers rolling restart when api-config ConfigMap changes — no manual rollout needed.
🎯 Interview Key Takeaway

ConfigMap volume mounts update within ~1 min but apps need restarts to reload. Use Reloader controller to auto-trigger rolling restarts on ConfigMap/Secret changes.

#Kubernetes#ConfigMap#Hot Reload#Reloader#Configuration#Intermediate
Back to all Docker & Deployment Questions→

More Docker & Deployment Interview Questions

Beginner LevelDocker & Deployment

How do Docker Multi-Stage Builds minimize image size and improve security?

Beginner LevelDocker & Deployment

What is the difference between a Docker Container and a Virtual Machine (VM)?

Beginner LevelDocker & Deployment

What is the difference between a Docker Image and a Docker Container?