Google Cloud Professional Cloud Developer — Question 41
Your application is running in multiple Google Kubernetes Engine clusters. It is managed by a Deployment in each cluster. The Deployment has created multiple replicas of your Pod in each cluster. You want to view the logs sent to stdout for all of the replicas in your Deployment in all clusters.
Which command should you use?
Answer options
- A. kubectl logs [PARAM]
- B. gcloud logging read [PARAM]
- C. kubectl exec ג€"it [PARAM] journalctl
- D. gcloud compute ssh [PARAM] ג€"-command= ג€sudo journalctlג€
Correct answer: B
Explanation
The correct answer is B, as 'gcloud logging read' allows you to retrieve logs from Google Cloud's logging service, which aggregates logs from all clusters. The other options either focus on individual pods or require SSH access to a VM, which does not provide a complete view of the logs from all replicas across clusters.