Kubernetes
medium

Pregunta de Kubernetes #019e3a4f

Enunciado de la Pregunta
Kubernetes
#daemonset
#kubernetes
#pod
#node
Medio

What is the main purpose of a DaemonSet?

A

A DaemonSet ensures that all (or certain) nodes run a copy of a Pod.

Correcto
B

A DaemonSet ensures that the kubelet is constantly up and running.

C

A DaemonSet ensures that there are as many pods running as specified in the replicas field.

D

A DaemonSet ensures that a process (agent) runs on every node.

Explicación Oficial / Explicaciones de la Comunidad

A DaemonSet is a Kubernetes controller 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:

  • The DaemonSet controller watches the cluster's node list and creates a Pod for each node that matches its node selector (if any).
  • It uses the Kubernetes scheduler to place Pods on nodes, but unlike a Deployment, it does not rely on replicas count; instead, it ensures one Pod per node.
  • Common use cases include running cluster storage daemons (e.g., glusterd, ceph), log collection (e.g., fluentd, filebeat), and node monitoring (e.g., Prometheus Node Exporter).

Why the correct answer is right:
The statement "A DaemonSet ensures that all (or certain) nodes run a copy of a Pod" accurately describes the primary purpose of a DaemonSet. It guarantees that a specific Pod runs on every node (or a subset defined by node selectors).

Why the incorrect answers are wrong:

  • The statement that a DaemonSet ensures the kubelet is constantly up and running is incorrect. The kubelet is a systemd service managed by the operating system, not by a DaemonSet. DaemonSets manage Pods, not system services.
  • The statement that a DaemonSet ensures there are as many pods running as specified in the replicas field is incorrect. That describes a ReplicaSet or Deployment, which manage a desired number of replicas across the cluster, not per node.
  • The statement that a DaemonSet ensures a process (agent) runs on every node is partially true but imprecise. A DaemonSet runs a Pod (which contains one or more containers) on each node, not a bare process. The correct answer more accurately reflects the Kubernetes abstraction of Pods.