Questão de Kubernetes Workloads #019e3a4f
What is a DaemonSet?
It's a type of workload that ensures a specific set of nodes run a copy of a Pod.
It's a type of workload responsible for maintaining a stable set of replica Pods running in any node.
It's a type of workload that needs to be run periodically on a given schedule.
It's a type of workload that provides guarantees about ordering, uniqueness, and identity of a set of Pods.
Explicação Oficial / Explicações da Comunidade
A DaemonSet is a Kubernetes workload resource that ensures a copy of a Pod runs on all (or a subset of) nodes in a cluster. As nodes are added to the cluster, Pods are added to them; as nodes are removed, those Pods are garbage collected. Deleting a DaemonSet will clean up the Pods it created.
How it Works
DaemonSets are commonly used for cluster-level tasks such as running monitoring agents (e.g., Prometheus Node Exporter), log collectors (e.g., Fluentd), or storage daemons (e.g., glusterd). They are defined in YAML with kind: DaemonSet and use a selector to match Pod templates. The Kubernetes scheduler automatically places a Pod on each node that matches the node selector (if any).
Why the Correct Answer is Right
The correct answer states that a DaemonSet ensures a specific set of nodes run a copy of a Pod. This is accurate because DaemonSets guarantee that every eligible node runs exactly one instance of the Pod. If a node fails, the DaemonSet controller recreates the Pod on a new node if needed.
Why the Incorrect Answers are Wrong
- The description of maintaining a stable set of replica Pods running on any node refers to a Deployment (or ReplicaSet), which ensures a desired number of replicas are running across the cluster, not necessarily one per node.
- The description of a workload that runs periodically on a given schedule describes a CronJob, which creates Jobs on a time-based schedule.
- The description of providing guarantees about ordering, uniqueness, and identity of a set of Pods refers to a StatefulSet, which is used for stateful applications requiring stable network identities and persistent storage.