Bird
Raised Fist0
Kubernetesdevops~5 mins

Node components (kubelet, kube-proxy, container runtime) in Kubernetes - Commands & Configuration

Choose your learning style10 modes available
Introduction
Kubernetes nodes run software that helps manage containers and network traffic. These node components make sure containers run correctly and can talk to each other.
When you want to run containers on a worker machine in a Kubernetes cluster
When you need to manage container lifecycle on each node automatically
When you want to route network traffic inside the cluster to the right containers
When you want to use a container runtime like containerd or Docker to run containers
When you want to check or troubleshoot why containers on a node are not working
Commands
This command lists all nodes in the Kubernetes cluster to check their status and readiness.
Terminal
kubectl get nodes
Expected OutputExpected
NAME STATUS ROLES AGE VERSION worker-node1 Ready <none> 10d v1.26.0
This command checks if the kubelet service is running on the node. Kubelet manages container lifecycle on the node.
Terminal
systemctl status kubelet
Expected OutputExpected
● kubelet.service - kubelet: The Kubernetes Node Agent Loaded: loaded (/usr/lib/systemd/system/kubelet.service; enabled; vendor preset: disabled) Active: active (running) since Mon 2024-06-10 10:00:00 UTC; 5 days ago
This command checks if the kube-proxy service is running. Kube-proxy manages network rules for routing traffic to containers.
Terminal
systemctl status kube-proxy
Expected OutputExpected
● kube-proxy.service - Kubernetes Kube-Proxy Server Loaded: loaded (/usr/lib/systemd/system/kube-proxy.service; enabled; vendor preset: disabled) Active: active (running) since Mon 2024-06-10 10:00:00 UTC; 5 days ago
This command lists running containers using the container runtime interface. It shows containers managed by containerd or Docker.
Terminal
crictl ps
Expected OutputExpected
CONTAINER IMAGE CREATED STATE NAME ATTEMPT 123abc456def nginx:1.23.0 2 hours ago Running my-nginx 0
Key Concept

If you remember nothing else, remember: kubelet runs containers, kube-proxy routes network traffic, and the container runtime actually runs the container processes on each node.

Common Mistakes
Checking only 'kubectl get pods' without verifying node components
Pods may not run properly if node components like kubelet or container runtime are down, which 'kubectl get pods' alone won't show.
Always check node status with 'kubectl get nodes' and verify kubelet and container runtime services on the node.
Assuming container runtime is always Docker
Modern Kubernetes often uses containerd or other runtimes; commands or troubleshooting steps differ.
Use 'crictl' commands which work with any container runtime that supports the Container Runtime Interface.
Summary
Use 'kubectl get nodes' to check if nodes are ready and part of the cluster.
Check kubelet service status to ensure containers are managed properly on the node.
Check kube-proxy service status to confirm network traffic routing is active.
Use 'crictl ps' to list running containers via the container runtime on the node.

Practice

(1/5)
1. Which Kubernetes node component is responsible for making sure containers start and keep running on a node?
easy
A. kube-proxy
B. kubelet
C. container runtime
D. etcd

Solution

  1. Step 1: Understand the role of kubelet

    kubelet runs on each node and ensures containers are started and stay running as requested by the control plane.
  2. Step 2: Differentiate from other components

    kube-proxy manages network traffic, container runtime runs containers, and etcd stores cluster data.
  3. Final Answer:

    kubelet -> Option B
  4. Quick Check:

    Container management = kubelet [OK]
Hint: kubelet manages containers on nodes, not networking or storage [OK]
Common Mistakes:
  • Confusing kubelet with kube-proxy
  • Thinking container runtime manages container lifecycle
  • Selecting etcd which is for cluster data storage
2. Which of the following is the correct command to check the status of the kubelet service on a Linux node?
easy
A. systemctl status kube-proxy
B. docker ps | grep kubelet
C. systemctl status kubelet
D. kubectl get pods kubelet

Solution

  1. Step 1: Identify the service name for kubelet

    The kubelet runs as a system service named 'kubelet' on Linux nodes.
  2. Step 2: Use systemctl to check service status

    The command 'systemctl status kubelet' shows the running status of the kubelet service.
  3. Final Answer:

    systemctl status kubelet -> Option C
  4. Quick Check:

    Check kubelet service = systemctl status kubelet [OK]
Hint: Use systemctl with 'kubelet' to check its status [OK]
Common Mistakes:
  • Checking kube-proxy instead of kubelet
  • Using kubectl which manages cluster, not node services
  • Searching for kubelet in docker containers
3. Given the following command output snippet from a node, which component is responsible for managing network rules to allow pod communication?
NAME       STATUS   ROLES    AGE   VERSION
node-1     Ready    <none>   10d   v1.26.0

Active connections:
- kubelet running
- kube-proxy running
- container runtime running
medium
A. kube-proxy
B. container runtime
C. kubelet
D. etcd

Solution

  1. Step 1: Identify the role of kube-proxy

    kube-proxy manages network rules and traffic routing inside the cluster to enable pod communication.
  2. Step 2: Differentiate from other components

    kubelet manages containers, container runtime runs containers, and etcd stores cluster data.
  3. Final Answer:

    kube-proxy -> Option A
  4. Quick Check:

    Network management = kube-proxy [OK]
Hint: Network rules inside cluster are handled by kube-proxy [OK]
Common Mistakes:
  • Confusing kubelet with network management
  • Thinking container runtime manages networking
  • Selecting etcd which is unrelated to node networking
4. You notice pods on a node are not receiving network traffic correctly. You check and find kube-proxy is not running. Which command would you use to restart kube-proxy on a systemd-based node?
medium
A. systemctl restart kube-proxy
B. kubectl restart kube-proxy
C. systemctl restart kubelet
D. docker restart kube-proxy

Solution

  1. Step 1: Identify the correct service to restart

    Since kube-proxy manages network traffic and is not running, restarting kube-proxy service is needed.
  2. Step 2: Use systemctl to restart kube-proxy

    On systemd-based systems, 'systemctl restart kube-proxy' restarts the kube-proxy service properly.
  3. Final Answer:

    systemctl restart kube-proxy -> Option A
  4. Quick Check:

    Restart kube-proxy with systemctl restart kube-proxy [OK]
Hint: Restart kube-proxy service with systemctl to fix network issues [OK]
Common Mistakes:
  • Restarting kubelet instead of kube-proxy
  • Using kubectl which cannot restart node services
  • Trying to restart kube-proxy as a docker container
5. A Kubernetes node uses containerd as its container runtime. You want to verify that the container runtime is running correctly and can start containers. Which sequence of commands would you use to check containerd status and list running containers?
hard
A. docker ps && crictl status
B. systemctl status kubelet && docker ps
C. kubectl get pods && systemctl status containerd
D. systemctl status containerd && crictl ps

Solution

  1. Step 1: Check containerd service status

    Use 'systemctl status containerd' to verify the container runtime service is active and running.
  2. Step 2: List running containers with crictl

    Since containerd uses CRI, 'crictl ps' lists running containers managed by containerd.
  3. Final Answer:

    systemctl status containerd && crictl ps -> Option D
  4. Quick Check:

    Check containerd and containers with systemctl and crictl [OK]
Hint: Use systemctl for service and crictl for container runtime containers [OK]
Common Mistakes:
  • Using docker commands when containerd is runtime
  • Checking kubelet status instead of container runtime
  • Mixing kubectl pod commands with container runtime checks
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard