How to create and delete static pod

Blue futuristic stream Data Communication flying into digital technologic animation 3D rendering
Reading Time: 4 minutes

Hello readers, I’ll be covering about the details of How to create and delete static pod in kubernates.This guide presupposes that you have a fundamental knowledge of Kubernetes and how pods operate.


Static pods are directly managed by kubelet daemon on a specific node, without API server observing it.

It doesn’t have a replication controller linked with it; instead, the kubelet daemon keeps track of it and restarts it when it breaks.However, there is no health evaluation.Static pods are always bound to one kubelet daemon and always run on the same node with it.

A nice option to execute a pod on a single node without involving the Kubernetes control plane is to use static pods.


A Kubernetes cluster is required, and the command-line tool kubectl has to be set up to connect with your cluster. (go through the work flow and Kubernetes control plane components)

Now let’s see how to create static pods 

First, we would need to connect to the node where we want the static pod to run. As we are working on minikube so log in to minikube using command :

minikube ssh

Using this command, we enter into our minikube node.

The next step is, we have to place our static pod manifest file into the directory where all the other static pod manifest file is present 

To check which pod is the static pod, exit from your minikube node and in your terminal type command.

kubectl get pods --all-namespaces

By using this command you will see a list of pods. but, how do identify which pod is the static pod?

As we know that static pods are managed by kubelet. What kubelet will do, kubelet will append the name of the node with the pod name.

For example- “etcd-minikube”

Now, how to find out the path where all the manifest file of these 4 pods is present? For this, we have to check our config.yaml file which is present inside kubelet folder. Cat the config.yaml file using command.

Inside this file search for static pod path.

sudo cat /var/lib/kubelet/config.yaml 

again do “minikube ssh”

After that , type command cd /etc/kubernetes/manifests inside the node, the manifest files of the Kubernetes components are present means static pods file.

cd /etc/kubernetes/manifests

then do ls to see the static pod files present inside /etc/kubernetes/manifests.


Inside this directory now I am writing a manifest file for the static pod.

NOTE: first install any text editor of your choices like nano or vim. I am using nano for writing manifest files and make sure to type sudo before nano otherwise it will give an error of permission denied.

sudo nano staticpod.yaml
apiVersion: v1
kind: Pod
  name: staticpod
    role: staticpod-role
    - name: container
      image: nginx
        - name: port
          containerPort: 80
          protocol: TCP

we have created a file with Nginx container to run as a static pod over port 80.Save this file by doing ctrl x and y.

Log out from your minikube node and come back to your normal terminal and type “exit” .

and again check the status of the pod by using command.

kubectl get pods

now , type command

kubectl get pods --all-namespaces

you will see, earlier there are 4 files now we have 5 files .

so, you can see, that the pod with the name staticpod-minikube is successfully running.

pod creation—> kubelet manages the static pods so, kubelet scans the directory and accordingly creates/deletes the static pods based on the configuration from the configuration files.

At last for the deletion of the static pod simply do minikube ssh and again use cd /etc/kubernetes/manifests .

and remove the file by using command .

rm -rf staticpod.yaml


In Conclusion:

The blog explained how to create and delete static pod.I hope you enjoyed this practical instruction. Motivate yourself to create static pod, and utilize them while looking up more examples on Google.