Home

CKA Practice Task - Static Pod (Lab158)

Objective

Create a static pod with the following requirements:

What is a Static Pod?

A Static Pod is managed directly by the kubelet running on a node. Instead of creating the Pod through the Kubernetes API using kubectl, you place a Pod manifest in the kubelet's static pod directory.

The kubelet continuously watches this directory and automatically creates, updates, or removes Pods based on the files found there.

Exam Tip:
If you see the words Static Pod, think:

Step 1 - Connect to Worker2

    ssh worker2
    
INSERT SCREENSHOT: SSH to worker2

Step 2 - Verify Static Pod Path

Check the kubelet configuration:

    grep staticPodPath /var/lib/kubelet/config.yaml
    

Typical output:

    staticPodPath: /etc/kubernetes/manifests
    
INSERT SCREENSHOT: Static Pod Path

Step 3 - Create the Static Pod Manifest

Create the manifest file:

    sudo vi /etc/kubernetes/manifests/lab158pod.yaml
    

Contents:

    apiVersion: v1
    kind: Pod
    metadata:
      name: lab158pod
    spec:
      containers:
      - name: nginx
        image: nginx
    
INSERT SCREENSHOT: Static Pod Manifest

Step 4 - Wait for Kubelet to Create the Pod

No further commands are required on worker2. The kubelet automatically detects the new manifest file and starts the pod.

The kubelet continuously monitors the manifests directory and automatically starts any new pod definitions.

Step 5 - Verify the Pod

Return to the control plane and verify:

    kubectl get pods -A -o wide | grep lab158
    

Possible output:

    lab158pod-worker2    1/1 Running
    
INSERT SCREENSHOT: kubectl get pods

Additional Verification

    kubectl get pods -A -o wide
    
    kubectl describe pod lab158pod-worker2
    
INSERT SCREENSHOT: kubectl describe pod

Deleting a Static Pod

A common exam trick is understanding how static pods are removed.

This will NOT work permanently:

    kubectl delete pod lab158pod-worker2
    

The kubelet will immediately recreate the pod because the manifest file still exists.

Correct method:

    ssh worker2
    
    sudo rm /etc/kubernetes/manifests/lab158pod.yaml
    

Verify removal:

    kubectl get pods -A | grep lab158
    
INSERT SCREENSHOT: Delete Static Pod
INSERT SCREENSHOT: Verify Pod Removal

CKA Fast Solution

    ssh worker2
    
    cat <
    
    

Verification:

    kubectl get pods -A -o wide | grep lab158
    

Common Exam Clues

Question Clue Meaning
Static Pod Create YAML under /etc/kubernetes/manifests
Specific Node Mentioned SSH to that node and create the file there
Kubelet Managed Static Pod
Pod Reappears After Delete Manifest file still exists

What This Task Tests

Personal Notes

Add your own notes, troubleshooting steps, and exam tips here.