DaemonSet: A DaemonSet in Kubernetes is a controller that ensures that a specific pod is scheduled to run on every node in the cluster. It represents a set of pods that run on each node, ensuring that the specified pods are deployed and maintained across the entire cluster.

Here's an example DaemonSet YAML definition:

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: example-daemonset
spec:
  selector:
    matchLabels:
      app: example-app
  template:
    metadata:
      labels:
        app: example-app
    spec:
      containers:
      - name: example-container
        image: your-example-image:latest

In this example:

spec.selector.matchLabels defines the labels that the DaemonSet uses to identify the set of pods to manage. spec.template.metadata.labels specifies the labels applied to the pods created by the DaemonSet. The container definition (spec.template.spec.containers) includes details about the container, such as the image to use. When you apply this DaemonSet configuration, Kubernetes ensures that one instance of the specified pod runs on every node in the cluster. If nodes are added or removed, the DaemonSet adjusts accordingly to maintain the desired pod distribution.

To apply the DaemonSet configuration, you can use the following command:

kubectl apply -f your-daemonset-definition.yaml

Replace your-daemonset-definition.yaml with the actual filename or URL of your DaemonSet YAML configuration file.

Keep in mind that DaemonSets are particularly useful for running system-level or infrastructure-related tasks on every node, such as logging agents, monitoring agents, or other cluster-wide utilities.