0
0
GCPcloud~30 mins

GKE monitoring and logging in GCP - Mini Project: Build & Apply

Choose your learning style9 modes available
GKE Monitoring and Logging Setup
📖 Scenario: You are managing a Google Kubernetes Engine (GKE) cluster for a small company. To keep the cluster healthy and troubleshoot issues quickly, you need to set up monitoring and logging using Google Cloud's operations suite.
🎯 Goal: In this project, you will enable monitoring and logging for your GKE cluster by configuring the necessary settings and verifying that logs and metrics are collected properly.
📋 What You'll Learn
Enable Google Cloud Monitoring and Logging for the GKE cluster
Configure the cluster to export logs to Cloud Logging
Verify that monitoring metrics are available
Verify that logs from pods are collected
💡 Why This Matters
🌍 Real World
Monitoring and logging are essential for running reliable applications on Kubernetes. This project shows how to set up these features on GKE to keep your cluster healthy and troubleshoot issues.
💼 Career
DevOps engineers and cloud administrators often configure monitoring and logging to maintain system health and respond quickly to problems in production environments.
Progress0 / 4 steps
1
Create a GKE cluster with monitoring enabled
Use the gcloud command to create a GKE cluster named monitoring-cluster in the us-central1 region with monitoring enabled by setting --enable-stackdriver-kubernetes.
GCP
Need a hint?

The flag --enable-stackdriver-kubernetes enables both monitoring and logging integration for GKE.

2
Configure logging export to Cloud Logging
Set the cluster's logging service to logging.googleapis.com/kubernetes using the gcloud container clusters update command for the cluster monitoring-cluster in us-central1 region.
GCP
Need a hint?

Use gcloud container clusters update with the --logging-service flag to specify the logging destination.

3
Verify monitoring metrics are available
Use the gcloud command to list the monitoring metrics for the project and check for the metric kubernetes.io/container/cpu/usage_time.
GCP
Need a hint?

Use gcloud monitoring metrics list with a filter to find the CPU usage metric.

4
Check logs from pods in Cloud Logging
Use the gcloud logging read command to read logs from the resource type k8s_container and filter by the cluster name monitoring-cluster. Print the first 5 log entries.
GCP
Need a hint?

Use gcloud logging read with a filter for resource.type=k8s_container and limit the output to 5 entries.