Questão de Kubernetes Workloads #019e3a4f
Which Kubernetes resource workload ensures that all (or some) nodes run a copy of a Pod?
ReplicaSet
StatefulSet
DaemonSet
Deployment
Explicação Oficial / Explicações da Comunidade
The DaemonSet is the Kubernetes resource workload that ensures all (or some) nodes run a copy of a Pod. When a node is added to the cluster, a Pod is automatically added to that node; when a node is removed, the Pod is garbage collected. Deleting a DaemonSet cleans up the Pods it created.
How it Works
A DaemonSet ensures that all (or a subset of) nodes run a copy of a Pod. As nodes are added to the cluster, Pods are added to them. As nodes are removed, those Pods are garbage collected. This is useful for running cluster-wide services such as log collectors, monitoring agents, or storage daemons.
Why DaemonSet is Correct
The DaemonSet's primary purpose is to run a Pod on every node (or a subset of nodes selected by a node selector). This matches the requirement of ensuring that all (or some) nodes run a copy of a Pod.
Why Other Options are Incorrect
- ReplicaSet: A ReplicaSet ensures that a specified number of Pod replicas are running at any given time, but it does not guarantee that each node runs a copy. Pods can be scheduled on any node based on scheduler decisions.
- StatefulSet: A StatefulSet manages stateful applications with unique network identities and persistent storage. It does not ensure that every node runs a copy; it manages a set of Pods with ordered deployment and scaling.
- Deployment: A Deployment provides declarative updates for Pods and ReplicaSets. It manages replicas but does not enforce that each node runs a copy of the Pod.