If you are running clustered Kubernetes and are using static pods to run a pod on every node, you should probably be using a DaemonSet!
Static pods are managed directly by kubelet daemon on a specific node, without the API server observing it. It does not have an associated replication controller, and kubelet daemon itself watches it and restarts it when it crashes. There is no health check. Static pods are always bound to one kubelet daemon and always run on the same node with it.
Kubelet automatically tries to create a mirror pod on the Kubernetes API server for each static pod. This means that the pods are visible on the API server but cannot be controlled from there.
When kubelet starts, it automatically starts all pods defined in directory specified in --pod-manifest-path=
or --manifest-url=
arguments or add the staticPodPath: <the directory>
field in the KubeletConfiguration file, i.e. our static-web. (It may take some time to pull nginx image, be patient…):
文档:
https://kubernetes.io/docs/tasks/administer-cluster/static-pod/