Post

DaemonSet

Kubernetes DaemonSet example that deploys an Elasticsearch (Fluentd) pod on every node, including master nodes.

This DaemonSet manifest deploys an Elasticsearch (Fluentd) logging agent on every node in the cluster, including master nodes. The toleration for node-role.kubernetes.io/master with NoSchedule effect ensures the pod can run on control-plane nodes as well.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
controlplane $ cat ds.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: elasticsearch
  namespace: kube-system
  labels:
    app: elasticsearch
spec:
  selector:
    matchLabels:
      name:  elasticsearch
  template:
    metadata:
      labels:
        name: elasticsearch
    spec:
      tolerations:
      # this toleration is to have the daemonset runnable on master nodes
      # remove it if your masters can't run pods
      - key: node-role.kubernetes.io/master
        effect: NoSchedule
      containers:
      - name: elasticsearch
        image: k8s.gcr.io/fluentd-elasticsearch:1.20
This post is licensed under CC BY 4.0 by the author.