0
0
Kubernetesdevops~30 mins

Why cluster monitoring matters in Kubernetes - See It in Action

Choose your learning style9 modes available
Why Cluster Monitoring Matters
📖 Scenario: You are managing a Kubernetes cluster that runs several applications for your company. To keep everything running smoothly, you need to monitor the cluster's health and resource usage.
🎯 Goal: Learn how to set up basic cluster monitoring by creating a simple Kubernetes ConfigMap with monitoring settings, then apply a label selector to identify monitored nodes, and finally list the nodes being monitored.
📋 What You'll Learn
Create a ConfigMap named monitoring-config with a key enabled set to true
Create a label selector variable called monitor_label with the value monitor=true
Use kubectl get nodes -l monitor=true command to list nodes with the monitoring label
Print the output of the command
💡 Why This Matters
🌍 Real World
Monitoring Kubernetes clusters is essential to ensure applications run smoothly and resources are used efficiently.
💼 Career
DevOps engineers and site reliability engineers use cluster monitoring to detect issues early and maintain system stability.
Progress0 / 4 steps
1
Create a ConfigMap for monitoring
Create a Kubernetes ConfigMap named monitoring-config with a data key enabled set to true using the kubectl create configmap command.
Kubernetes
Need a hint?

Use kubectl create configmap monitoring-config --from-literal=enabled=true to create the ConfigMap.

2
Set a label selector variable
Create a shell variable called monitor_label and set it to the string monitor=true.
Kubernetes
Need a hint?

Use monitor_label="monitor=true" to create the variable.

3
List nodes with the monitoring label
Use the kubectl get nodes command with the label selector stored in monitor_label to list all nodes labeled for monitoring.
Kubernetes
Need a hint?

Use kubectl get nodes -l $monitor_label to list nodes with the label.

4
Display the monitored nodes
Print the output of the kubectl get nodes -l $monitor_label command to show the nodes currently monitored.
Kubernetes
Need a hint?

Running kubectl get nodes -l $monitor_label will print the nodes with the label.