Lab 2.2 - Analyzing Worker Nodes
Objectives
By the end of this lab, you will be able to:
- Inspect Worker Nodes
- Understand the role of kubelet
- Analyze kube-proxy
- Examine the Container Runtime
Prerequisites
- Working Kubernetes cluster
- kubectl installed and configured
- Cluster access
Exercise 1: Inspect Nodes
Step 1: List Nodes
# View all nodes
kubectl get nodes
# View node details
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 node labels
kubectl get node <node-name> --show-labels
# View annotations
kubectl get node <node-name> -o jsonpath='{.metadata.annotations}'
Exercise 2: Analyze kubelet
Step 1: Verify kubelet
# View system Pods related to kubelet
kubectl get pods -n kube-system | grep kubelet
# View node events
kubectl get events --field-selector involvedObject.name=<node-name>
Step 2: Node Metrics
# View node resource usage
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: Verify kube-proxy
# View kube-proxy Pod
kubectl get pods -n kube-system -l k8s-app=kube-proxy
# View kube-proxy logs
kubectl logs -n kube-system -l k8s-app=kube-proxy --tail=50
Step 2: Verify Services
# List all Services
kubectl get services --all-namespaces
# View Service Endpoints
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 images in use
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: Resources Used
# 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 needed.
Next Steps
Lab 2.3: Monitoring System Components
Module 3: Pods and Deployments
Lab created: December 2024