Professional Cloud Architect · Free Practice Question Hard
Question 31
You are a cloud architect responsible for a microservices-based application deployed in Google Kubernetes Engine (GKE). The application consists of several interacting containers. To optimize performance, you want to ensure that these containers are located as close to each other as possible. Which of the following would be the most effective way to achieve this?
-
A
Increase the number of replicas for each container to ensure they are distributed across all nodes in the cluster.
-
B
Use node taints and tolerations to force certain containers to run on specific nodes.
-
C
Use the
PodAffinityandPodAntiAffinityrules in your Kubernetes pod specification. -
D
Use GKE Regional Clusters to deploy the containers across multiple zones in the same region.
Reveal correct answer
Correct answer: C
A.
Increasing the number of replicas can improve the availability and performance of your application by distributing the workload across more containers. However, it does not ensure that specific containers are co-located.
B.
Node taints and tolerations are used to restrict the kinds of pods that can be scheduled on specific nodes, but they are not the best way to ensure that specific containers are co-located.
C.
The PodAffinity and PodAntiAffinity rules are designed to control how Kubernetes schedules pods relative to each other. By properly configuring these rules, you can make sure that certain pods (and therefore the containers inside them) are co-located on the same node or within the same zone.
D.
GKE Regional Clusters are used to increase the availability of your application by deploying across multiple zones in the same region. This strategy might spread your containers further apart, not bring them closer together.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
