DaemonSets

DaemonSets can be used to schedule one pod per node on either all or a subset of nodes, providing similar functionality to an init system.

apiVersion: apps/v1
kind: DaemonSet
metadata:
    name: my-service
spec:
    selector:
        matchLabels:
            app: my-service
    template:
        metadata:
            labels:
                app: my-service
    containers:
      - name: my-service
          image: some-service

Workloads that may run on DaemonSets include:

  • `kube-proxy`
  • Log collectors
  • Metric servers
  • Resource monitoring agents
  • Storage daemons

Node selector

The pod template can include a nodeSelector, limiting which nodes the DaemonSet will consider when scheduling the pod.

# Inside a DaemonSet.spec.template.spec:
nodeSelector:
    matchLabels:
        someKey: someValue

Update strategies

Update strategies define the DaemonSet controller's behaviour when the object is updated:

  • RollingUpdate, the default, will stop and recreate at most maxUnavailable (default 1) at a time.
  • OnDelete will only take action upon deletion of the pods by something else.

Backlinks