Static Pods
Describe about Static Pods
Static Pods is the one way the kubelet
use to create the Pod without kube-api-server
so it mean we didn't need to have cluster.
The way we doing is configure the designator folder that we store the pod-definition.yaml
(pod template). Whenever this file is updated or removed, the corresponding Pod is automatically updated or removed accordingly.
There are 2 option for configure this path folder:
--pod-mainifest-path=/path
( default path = /etc/Kubernetes/manifests )-- config=kubec-config.yaml
and inside the config file you need to add this property
staticPodPath: /etc/Kubernetes/manifests
If we create the Pod which this way but we have Master Node (have kube-api-server)
the Node will be read only for this Pod It can only view but can't update or remove except you update or remove the definition file
Noted:
For the Pod that was created by kubelet the name of the Pod will always be <pod_name>-<node_name>
It will ignore the Kube-scheduler
UseCase
When the service is crash and restart we still can recover the Pod by
kubelet
from definition file
CheatSheet command
Check the static pod path:
cat /var/lib/kubelet/config.yaml
Create static pod:
kubectl run <pod_name> --image=<image_name> --restart=Never --dry-run=client -o yaml > <file_name>.yaml
Last updated