Deployment 部署的副本 Pod 会分布在各个 Node 上,每个 Node 都可能运行好几个副本。DaemonSet 的不同之处在于:每个 Node 上最多只能运行一个副本。
主要区别:
The scalability is much better when using a Deployment, because you will have a Single-Pod-per-Node model when using the DaemonSet.
It is possible to exclusively run a Service on a dedicated set of machines using taints and tolerations with a DaemonSet.
On the other hand the DaemonSet allows you to access any Node directly on Port 80 and 443, where you have to setup a Service object with a Deployment.
DaemonSet 的典型应用场景有:
在集群的每个节点上运行存储 Daemon,比如 glusterd 或 ceph。
在每个节点上运行日志收集 Daemon,比如 flunentd 或 logstash。
在每个节点上运行监控 Daemon,比如 Prometheus Node Exporter 或 collectd。