Course contentsShow
← Docker, Kubernetes & CI/CD
Lesson 241 of 8024. Kubernetes Architecture and Core ObjectsFree lesson

Executing Workloads with the Kubelet

Learn how the Kubelet agent running on each worker node ensures that containers are healthy and running according to the pod specifications.

In this lesson, you will learn how the Kubelet acts as the primary local agent on each worker node to transform desired pod specifications into running containers.

The Heart of the Worker Node

If the Control Plane is the brain of your Kubernetes cluster, the Kubelet is the diligent worker on the ground. Every worker node in your cluster runs a Kubelet process. Its primary job is to ensure that the containers described in your PodSpec are actually running and healthy.

When the Scheduler assigns a Pod to a specific node, the Kubelet on that node receives the manifest. It doesn't just "start" the container and walk away; it actively manages the lifecycle of that workload.

How the Kubelet Maintains Reality

The Kubelet performs its job through a constant control loop:

  1. Syncing: It watches the API Server for new Pod assignments.
  2. Execution: It interacts with the container runtime (like containerd or CRI-O) to pull images, create containers, and start them.
  3. Monitoring: It keeps a constant eye on the status of these containers. If a container crashes or exits, the Kubelet notices the deviation from the desired state and attempts to restart it according to the Pod's restartPolicy.
  4. Health Probes: It executes liveness and readiness probes. If a service becomes unresponsive, the Kubelet will kill and restart the container to restore health.

Think of the Kubelet as a meticulous supervisor:

# A typical Pod manifest that the Kubelet monitors
apiVersion: v1
kind: Pod
metadata:
  name: web-server
spec:
  containers:
  - name: nginx
    image: nginx:latest
    livenessProbe:
      httpGet:
        path: /
        port: 80

In this example, the Kubelet doesn't just start the Nginx container once. It continuously sends requests to port 80. If the web server stops responding to those requests, the Kubelet recognizes the failure and restarts the container to keep your application online without manual intervention. It effectively bridges the gap between the high-level instructions from the Control Plane and the actual container execution on your host.

Key Takeaway: The Kubelet is the local agent responsible for watching the desired state defined in your Pod specifications and continuously reconciling that state by managing the container runtime on its specific worker node.