Which component in Google Kubernetes Engine (GKE) is primarily responsible for collecting cluster metrics and sending them to Cloud Monitoring?
Think about the agent that collects metrics specifically for monitoring purposes.
The Stackdriver Kubernetes Monitoring Agent collects cluster and node metrics and sends them to Cloud Monitoring. The Cloud Logging Agent handles logs, Kubelet Metrics Server provides metrics but is not the main agent for Cloud Monitoring, and Cloud Trace Collector is for tracing.
What is the output of the following command when run on a GKE cluster?
kubectl logs -n kube-system -l k8s-app=kube-dns --tail=2
Consider how kubectl logs works with label selectors and the --tail option.
The command fetches logs from all pods matching the label in the specified namespace and shows the last 2 lines of each pod's logs. It does not return an error and does not limit to only one pod.
You want to configure Fluentd on GKE to route logs from a specific namespace to a custom Cloud Logging log bucket. Which configuration snippet correctly sets the match directive for logs from namespace custom-ns?
Focus on the match directive pattern that filters logs by namespace in Fluentd.
Option B correctly matches log files from containers in the custom-ns namespace by using the log file path pattern. Other options misuse filter inside match or have invalid syntax.
You notice that your GKE cluster metrics are not appearing in Cloud Monitoring. Which of the following is the most likely cause?
Think about the component responsible for sending metrics to Cloud Monitoring.
If the Stackdriver Kubernetes Monitoring Agent DaemonSet is not running, metrics won't be collected or sent to Cloud Monitoring. CPU resources or Cloud Logging API do not directly affect metrics collection, and the API server being down would cause broader issues.
Which practice is best to ensure logs collected from GKE workloads are securely transmitted and stored in Cloud Logging?
Consider encryption and access control best practices for cloud logging.
Enabling TLS encryption ensures logs are securely transmitted. Using IAM roles with least privilege limits access to logs. Storing logs unencrypted or disabling Cloud Logging API reduces security. Sending logs over plaintext HTTP is insecure.