Inspecting Deployed Pods
Begin by verifying the running Pods in your cluster. Execute the following command:Deploying the Metrics Server
To monitor resource usage, you’ll deploy the metrics server. This lab uses a preconfigured Git repository containing all the necessary configurations.Do not use these configurations in a production environment. Always refer to the official documentation before deploying to production.
Step 1: Clone the Repository
Clone the repository by running:Step 2: Review the Repository Contents
First, check the directory structure:kubernetes-metrics-server and possibly a file like sample.yaml. Next, navigate into the repository directory and list its files:
- README.md
- aggregated-metrics-reader.yaml
- auth-delegator.yaml
- metrics-server-deployment.yaml
- metrics-server-service.yaml
- resource-reader.yaml (if present)
Step 3: Deploy the Metrics Server
Deploy the metrics server by creating all required objects with the following command:
Verifying Metrics Collection
After deployment, you can view resource usage by using thekubectl top commands.
Check Node Resource Utilization
Run the following command:Check Pod Resource Utilization
To view the resource allocation for each Pod, execute:Analyzing Resource Consumption
Use the collected metrics to identify resource usage by both nodes and Pods.Node Resource Analysis
-
Identifying the Node with the Highest CPU Consumption
From the
kubectl top nodeoutput, the “controlplane” node shows a CPU usage of approximately 470 milli cores, which is significantly higher than node01’s 57 milli cores. Answer: The controlplane node consumes the most CPU. - Identifying the Node with the Highest Memory Consumption The controlplane node also consumes 1252Mi of memory compared to node01’s 349Mi. Answer: The controlplane node consumes the most memory.
Pod Resource Analysis
- Identifying the Pod with the Highest Memory Consumption The “rabbit” Pod consumes 252Mi of memory, which is higher than the other two Pods. Answer: The “rabbit” Pod consumes the most memory.
- Identifying the Pod with the Lowest CPU Consumption The “lion” Pod uses only 1m of CPU, making it the least resource-intensive among the Pods. Answer: The “lion” Pod consumes the least CPU.
Recap
In this lesson, you performed the following steps:- Inspected running Pods using the
kubectl get podscommand. - Cloned and explored a preconfigured metrics server repository.
- Deployed the metrics server using
kubectl create -f .. - Verified node and Pod resource usage utilizing the
kubectl topcommands. - Analyzed resource consumption to identify which nodes and Pods were consuming the most or least CPU and memory.