Exam CKA Topic 2 Question 64 Discussion

Actual exam question for Linux Foundation's CKA exam
Question #: 64
Topic #: 2
You have a Deployment named 'nginx-deployment running an Nginx server. The Nginx configuration file is stored in a ConfigMap named 'nginx-config'. You need to dynamically update the Nginx configuration file without restarting the Nginx pods.

Suggested Answer:

See the solution below with Step by Step Explanation.
Explanation:
Solution (Step by Step) :
1 . Create the ConfigMap (if not already existing):
- Define a ConfigMap named 'nginx-config' containing the Nginx configuration file. For example, create a file 'nginx.conf with the desired configuration and then create the ConfigMap using 'kubectl create configmap nginx-config --from-file=nginx.conf:
kubectl create configmap nginx-config --from-file=nginx.conf
2. Configure Nginx Deployment:
- Modify the 'nginx-deployment' Deployment to mount the 'nginx-config' ConfigMap as a volume.
- Use 'volumeMounts' to specify where the ConfigMap should be mounted (e.g., '/etc/nginx/conf.d/' ) and 'volumes' to define the ConfigMap as a volume source.
- Update the Nginx container's configuration to use the mounted configuration file (e.g., 'nginx -g daemon off;').

3. Update the ConfigMap: - Modify the 'nginx-config' ConfigMap with the new configuration content. This can be done using 'kubectl patch' or 'kubectl edit': kubectl patch configmap nginx-config -p '{"data": {"nginx.conf": "new_nginx_configuration"}}' 4. Observe Nginx Pods: - Monitor the Nginx pods in the 'nginx-deployment' Deployment. Since the ConfigMap is mounted as a volume, Nginx will automatically reload the configuration file without restarting the pod. 5. Verify the Update: - Use 'kubectl logs' or 'kubectl exec' to examine the Nginx pod's logs and confirm that the new configuration is being used.

by Jeremy at Jun 04, 2026, 01:43 AM

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Nick name: Submit Cancel
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

0
0
0
10