Choose a node with in the Kubernetes cluster where you want to run the static Pod. In this example, it's my-node1.

Then connect to my-node1 using SSH (ssh my-node1).

Choose a directory, say "/etc/kubernetes/manifests" and place a web server Pod definition there, for example "/etc/kubernetes/manifests/static-pod.yaml" place a yaml file in that particular location path.

Then move pod manifest YAML into Static Pod default directory location path.
$ mv static-pod.yaml /etc/kubernetes/manifests/static-pod.yaml

Run this command on the node where the kubelet is running.
$ systemctl restart kubelet

$ kubectl get pods
NAME                  READY   STATUS    RESTARTS        AGE
static-web-my-node1   1/1     Running   0               2m

If you try to use kubectl to delete the mirror Pod from the API server, the kubelet doesn't remove the static Pod.

$ kubectl delete pod static-web-my-node1
pod "static-web-my-node1" deleted

You can see that the Pod is still running.

$ kubectl get pods
NAME                  READY   STATUS    RESTARTS   AGE
static-web-my-node1   1/1     Running   0          4s

The running kubelet periodically scans the configured directory "/etc/kubernetes/manifests" for changes and adds/removes Pods as files appear/disappear in this directory.

$ mv /etc/kubernetes/manifests/static-pod.yaml /tmp

$ mv /tmp/static-pod.yaml /etc/kubernetes/manifests/
