Create a static pod with the following requirements:
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.
ssh worker2
Check the kubelet configuration:
grep staticPodPath /var/lib/kubelet/config.yaml
Typical output:
staticPodPath: /etc/kubernetes/manifests
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
No further commands are required on worker2. The kubelet automatically detects the new manifest file and starts the pod.
Return to the control plane and verify:
kubectl get pods -A -o wide | grep lab158
Possible output:
lab158pod-worker2 1/1 Running
kubectl get pods -A -o wide
kubectl describe pod lab158pod-worker2
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
ssh worker2
cat <
Verification:
kubectl get pods -A -o wide | grep lab158
| 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 |
Add your own notes, troubleshooting steps, and exam tips here.