Challenge, Medium,  on  Kubernetes

Mount Specific ConfigMap Keys as Files into a Node.js Deployment

Scenario

A Deployment named orders-api-reader exists in namespace production, but its Pods are failing because the application configuration is missing.

A ConfigMap named app-config exists in the same namespace and contains multiple configuration keys for a Node.js application. However, the application requires only three keys: api.url, app.port, and app.order.

The Deployment manifest is located on dev-machine:

/home/laborant/nodejs-deployment.yaml

Task

Mount only the following three keys from the app-config ConfigMap as files inside /etc/app/config using a volume named app-config-vol. No other keys from app-config should be accessible inside the Pod.

api.url
app.port
app.order

Edit /home/laborant/nodejs-deployment.yaml and apply the updated manifest after making changes.

The diagram shows only selected ConfigMap keys mounted as files inside the Pod.

The diagram shows only selected ConfigMap keys mounted as files inside the Pod.

⚠️ Add only the required YAML changes; do not modify or add anything unnecessary.


Hint 1

Use items inside the ConfigMap volume definition to mount only specific keys. Each item maps a ConfigMap key to a file path inside the mount directory.

See the official docs: Configure a Pod to Use a ConfigMap


Test Cases