4. You enabled Cloud Monitoring on your GKE cluster, but metrics do not appear in the Cloud Console. What is a likely cause?
medium
A. The cluster is in a different Google Cloud project
B. kubectl logs command was not run
C. Cloud Logging is disabled, so metrics cannot show
D. The cluster was updated with incorrect monitoring flags
Solution
Step 1: Check monitoring setup flags
If monitoring flags were set incorrectly during cluster update, metrics won't appear.
Step 2: Evaluate other options
kubectl logs does not affect metrics. Cloud Logging can be separate from Monitoring. Different project would cause access issues but not necessarily missing metrics if viewed correctly.
Final Answer:
The cluster was updated with incorrect monitoring flags -> Option D
Quick Check:
Incorrect monitoring flags block metrics [OK]
Hint: Check monitoring flags in cluster update command [OK]
Common Mistakes:
Assuming kubectl logs affects metrics
Confusing logging with monitoring
Ignoring project or permissions issues
5. You want to monitor a custom application metric in your GKE cluster and view it in Cloud Monitoring. Which steps should you take?
hard
A. Instrument your app to expose metrics, deploy Prometheus, and configure Cloud Monitoring to scrape them
B. Enable Cloud Logging only and check logs for metric data
C. Use kubectl logs to collect metrics from pods and upload manually
D. Create a new GKE cluster with monitoring enabled and redeploy your app
Solution
Step 1: Instrument the application
Custom metrics require your app to expose them, usually via Prometheus format.
Step 2: Deploy Prometheus and configure scraping
Prometheus collects metrics from your app. Cloud Monitoring can integrate with Prometheus to display metrics.
Step 3: Understand other options
Cloud Logging alone does not handle custom metrics. kubectl logs is for logs, not metrics. Creating a new cluster is unnecessary.
Final Answer:
Instrument your app to expose metrics, deploy Prometheus, and configure Cloud Monitoring to scrape them -> Option A