Lab 2.2 - Analysis of Worker Nodes
Objectives
By the end of this lab, you will be able to:
- Inspect the Worker Nodes
- Understand the role of kubelet
- Analyze kube-proxy
- Examine the Container Runtime
Prerequisites
- A working Kubernetes cluster
- kubectl installed and configured
- Access to the cluster
Exercise 1: Inspect the Nodes
Step 1: List the Nodes
# View all nodes
kubectl get nodes
# View details of a node
kubectl describe node <node-name>
# View nodes with more information
kubectl get nodes -o wide
Question: How many Worker Nodes do you have? What are their roles?
Step 2: Node Information
# View labels of a node
kubectl get node <node-name> --show-labels
# View annotations
kubectl get node <node-name> -o jsonpath='{.metadata.annotations}'
Exercise 2: Analyze kubelet
Step 1: Check kubelet
# View system Pods related to kubelet
kubectl get pods -n kube-system | grep kubelet
# View events of a node
kubectl get events --field-selector involvedObject.name=<node-name>
Step 2: Node Metrics
# View resource usage of a node
kubectl top node <node-name>
# View resource details
kubectl describe node <node-name> | grep -A 10 "Allocated resources"
Exercise 3: Analyze kube-proxy
Step 1: Check kube-proxy
# View the kube-proxy Pod
kubectl get pods -n kube-system -l k8s-app=kube-proxy
# View logs of kube-proxy
kubectl logs -n kube-system -l k8s-app=kube-proxy --tail=50
Step 2: Check the Services
# List all Services
kubectl get services --all-namespaces
# View Endpoints of a Service
kubectl get endpoints <service-name>
Exercise 4: Container Runtime
Step 1: Identify the Runtime
# View node information (contains the runtime)
kubectl describe node <node-name> | grep "Container Runtime"
# View used images
kubectl get pods --all-namespaces -o jsonpath='{range .items[*]}{.spec.containers[*].image}{"\n"}{end}' | sort -u
Exercise 5: Pods on a Node
Step 1: Assigned Pods
# View all Pods on a specific node
kubectl get pods --all-namespaces --field-selector spec.nodeName=<node-name>
# Count Pods per node
kubectl get pods --all-namespaces -o wide | awk '{print $7}' | sort | uniq -c
Step 2: Used Resources
# View resource usage by Pod
kubectl top pods --all-namespaces
# Filter by node
kubectl top pods --all-namespaces | grep <node-name>
Reflection Questions
- How many Pods can run on each node?
- How does kubelet manage resources?
- What is the role of kube-proxy on each node?
- How is the Container Runtime used?
Cleanup
No cleanup necessary.
Next Steps
Lab 2.3: Monitoring System Components
Module 3: Pods and Deployments
Lab created on: December 2024