Static pods Doubt

HI, Can anyone help me with below:

ques: Create a static pod named static-busybox that uses the busybox image and the command sleep 1000

I used below command: kubectl run --restart=Never --image=busybox static-busybox --dry-run -o yaml --command – sleep 1000 > /etc/kubernetes/manifests/static-busybox.yaml

Then I added this file’s location in “/lib/systemd/system/kubelet.service” as below:
ExecStart=/usr/bin/kubelet $KUBELET_OPTS


sudo systemctl daemon-reload
sudo systemctl restart kubelet

But still my static pod is not created.

What did I miss?

First of all, in which Node you wants to create a static pod for example in master or worker node. Following example is for master node.
To check the default static pod manifests file path is located where,
ps -aux | grep -i kubelet
after observing o/p of the input, you will see this line.
Moving into this location in master node.
cat config.yaml
staticPodPath: /etc/kubernetes/manifests
In above path is for static pod manifests. Move into that directory and create static manifest file what you created earlier.
After that kubelet will track that newly static pod file which is available and kubelet will restart the process and automatically create a static Pod with NODE name.
You don’t need to add --pod-manifest-path.

you can check via kubelet service as well.
systemctl cat kubelet

Thanks for the reply…It worked.