Inspecting Running Pods
Before setting up monitoring, verify that your workloads are running correctly by listing the pods:rabbit pod should transition to a running state:
Deploying the Metrics Server
To monitor resource consumption, you need to deploy the Kubernetes Metrics Server. In this lab, we use a preconfigured repository with the required settings.For production environments, avoid using these lab-specific configurations. Always refer to the official Metrics Server documentation for accurate and secure deployment.
Step 1: Clone the Repository
Clone the repository that includes the metrics server configuration:Step 2: Examine the Configuration Files
Navigate to the repository directory and list its contents to review the configuration files:Step 3: Deploy the Metrics Server
Deploy all required objects with the following command:It may take a few minutes for the Metrics Server to begin gathering and reporting resource data.
Verifying Metrics and Analyzing Resource Consumption
Once the Metrics Server is up and running, you can verify the resource usage on your nodes and pods.Checking Node Metrics
To check the CPU and memory usage for each node, run:Checking Pod Metrics
To list the resource usage for individual pods, execute:Analyzing the Data
After gathering metrics, you can analyze them to understand resource consumption patterns across your cluster.Identifying the Node with the Highest CPU Usage
Review the node metrics—for example:Identifying the Node with the Highest Memory Usage
Using the node metrics:Determining the Pod Using the Most Memory
Analyze the pod metrics to pinpoint the pod consuming the most memory:rabbit pod is using the most memory (252Mi), indicating that its workload—possibly RabbitMQ—may require higher resource allocation.
Identifying the Pod with the Least CPU Usage
From the pod metrics, notice that certain pods consistently consume minimal CPU (around 1m), suggesting low processing requirements for those workloads.Conclusion
In this guide, you learned how to:- Inspect running pods to ensure your workloads are active.
- Deploy the Kubernetes Metrics Server using a preconfigured repository.
- Verify and analyze resource usage on both nodes and pods within your cluster.