0
0
GCPcloud~20 mins

GKE monitoring and logging in GCP - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
GKE Monitoring and Logging Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding GKE Monitoring Components

Which component in Google Kubernetes Engine (GKE) is primarily responsible for collecting cluster metrics and sending them to Cloud Monitoring?

ACloud Trace Collector
BCloud Logging Agent
CKubelet Metrics Server
DStackdriver Kubernetes Monitoring Agent
Attempts:
2 left
💡 Hint

Think about the agent that collects metrics specifically for monitoring purposes.

💻 Command Output
intermediate
2:00remaining
Output of kubectl command for logs

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
AShows the last 2 log lines from all pods labeled k8s-app=kube-dns in kube-system namespace
BShows logs only from the first pod found with label k8s-app=kube-dns
CReturns an error because --tail cannot be used with label selector
DShows logs from all namespaces for pods labeled k8s-app=kube-dns
Attempts:
2 left
💡 Hint

Consider how kubectl logs works with label selectors and the --tail option.

Configuration
advanced
3:00remaining
Configuring Fluentd for Custom Log Routing

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?

A
<match kubernetes.**>
  @type google_cloud
  <buffer>
    @type memory
  </buffer>
  <filter>
    @type grep
    <regexp>
      key $.kubernetes.namespace_name
      pattern ^custom-ns$
    </regexp>
  </filter>
</match>
B
<match kubernetes.var.log.containers.*custom-ns*.log>
  @type google_cloud
</match>
C
<match kubernetes.**>
  @type google_cloud
  <filter kubernetes.namespace_name>
    @type grep
    <regexp>
      key $.kubernetes.namespace_name
      pattern ^custom-ns$
    </regexp>
  </filter>
</match>
D
<match kubernetes.**>
  @type google_cloud
  <filter kubernetes.namespace_name custom-ns>
  </filter>
</match>
Attempts:
2 left
💡 Hint

Focus on the match directive pattern that filters logs by namespace in Fluentd.

Troubleshoot
advanced
2:30remaining
Troubleshooting Missing Metrics in Cloud Monitoring

You notice that your GKE cluster metrics are not appearing in Cloud Monitoring. Which of the following is the most likely cause?

ACloud Logging API is disabled in the GCP project
BThe cluster nodes do not have sufficient CPU resources
CThe Stackdriver Kubernetes Monitoring Agent DaemonSet is not running on the nodes
DThe Kubernetes API server is down
Attempts:
2 left
💡 Hint

Think about the component responsible for sending metrics to Cloud Monitoring.

Best Practice
expert
3:00remaining
Best Practice for Secure Logging in GKE

Which practice is best to ensure logs collected from GKE workloads are securely transmitted and stored in Cloud Logging?

AEnable TLS encryption for Fluentd agents and use IAM roles with least privilege for log writing
BStore logs locally on nodes and periodically upload them to Cloud Storage without encryption
CDisable Cloud Logging API and use third-party logging tools without encryption
DUse plaintext HTTP to send logs to Cloud Logging for faster transmission
Attempts:
2 left
💡 Hint

Consider encryption and access control best practices for cloud logging.