DOP-C02 Question 180
Select 3Your team is running a highly available web application using Amazon Elastic Kubernetes Service (EKS) with managed node groups. You notice increased latency and intermittent errors during peak traffic hours. Upon inspection, it is evident that certain pods are being restarted due to resource constraints. As a DevOps Engineer, which actions could you take to resolve this issue while ensuring application stability and performance?
- A
Increase the CPU and memory requests and limits for the affected pods.
- B
Use Kubernetes Horizontal Pod Autoscaler (HPA) to scale the number of pods based on CPU or memory utilization.
- C
Migrate the workload to Amazon ECS with Fargate to eliminate resource constraints.
- D
Enable cluster auto-scaling to add additional nodes when necessary.
- E
Reduce the number of replicas in the deployment to free up resources.
Show answer and explanation
Correct answers: A, B, D
Explanation
The increased latency and pod restarts are due to resource constraints in the EKS cluster. To resolve this, you can increase resource requests and limits for the pods to ensure they have adequate resources, implement Kubernetes Horizontal Pod Autoscaler (HPA) to dynamically scale the pods during peak traffic, and enable cluster auto-scaling to add more nodes when resource demand increases. Migrating to ECS with Fargate is unnecessary, and reducing replicas would harm the application's availability.
- A. Correct.
Correct: Increasing the CPU and memory requests and limits for pods ensures that they are allocated sufficient resources to handle their workload, reducing the likelihood of resource constraints.
- B. Correct.
Correct: The Horizontal Pod Autoscaler (HPA) dynamically adjusts the number of pods based on utilization metrics, which can help handle peak traffic more effectively.
- C. Incorrect.
Incorrect: Migrating to Amazon ECS with Fargate is not necessary in this scenario and would require a significant architectural change. The issue can be resolved within the existing EKS setup.
- D. Correct.
Correct: Enabling cluster auto-scaling ensures that additional nodes are provisioned when the current nodes are running out of resources, addressing the resource constraints at the cluster level.
- E. Incorrect.
Incorrect: Reducing the number of replicas would decrease the application's ability to handle traffic, worsening the situation instead of resolving it.