Google Professional Cloud DevOps Engineer exam dumps

Google Professional Cloud DevOps Engineer practice question 111 of 268

Professional Cloud DevOps Engineer. Associate level, Google Cloud. Free question with the correct answer and a full explanation.

Google Professional Cloud DevOps Engineer Question 111

Select 2Google Cloud Platform

You are managing a Kubernetes-based application deployed on Google Kubernetes Engine (GKE). You need to drain traffic from a specific pod before performing maintenance on it, ensuring that no new traffic is directed to the pod while allowing existing connections to complete gracefully. What steps should you take?

  1. A

    Cordon the node hosting the pod to prevent new pods from being scheduled on it.

  2. B

    Use the kubectl drain command on the node hosting the pod.

  3. C

    Update the Service's selector to exclude the labels associated with the pod.

  4. D

    Set the pod's readiness probe to fail so it is removed from the Service's endpoints.

  5. E

    Delete the pod directly to terminate all traffic to it immediately.

Show answer and explanation

Correct answers: C, D

Explanation

To gracefully drain traffic from a specific pod in GKE, you must prevent the pod from receiving new traffic while allowing existing connections to complete. Updating the Service's selector and failing the pod's readiness probe are effective ways to achieve this, as they remove the pod from the Service's endpoints without disrupting existing connections. Actions like deleting the pod or draining the node are either too aggressive or not specific to the pod and do not meet the requirements.

  • A. Incorrect.

    Cordon marks a node as unschedulable, preventing new pods from being scheduled on it. However, this does not drain traffic from the pod and is not specific to the traffic redirection scenario.

  • B. Incorrect.

    kubectl drain is used to evict pods from a node for maintenance purposes but is not granular to a specific pod. This is not applicable when you want to drain traffic from a single pod.

  • C. Correct.

    Updating the Service's selector to exclude the pod's labels ensures that the pod is no longer part of the Service, effectively draining new traffic from it.

  • D. Correct.

    Failing the pod's readiness probe removes it from the Service's endpoints without abruptly killing the pod, allowing existing connections to complete gracefully.

  • E. Incorrect.

    Deleting the pod immediately terminates all traffic to it, disrupting any ongoing connections. This does not meet the requirement of allowing existing connections to complete gracefully.

Timed practice exam

Take a Google Professional Cloud DevOps Engineer practice test under exam conditions

60 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam