8. Daemon setsο
A daemonset is similar to a deployment but is restricted to one replica per node. First, let us create a multinode cluster:
$ minikube start -n 3
π minikube v1.33.1 on Ubuntu 24.04
β¨ Automatically selected the docker driver. Other choices: kvm2, virtualbox, ssh
π Using Docker driver with root privileges
π Starting "minikube" primary control-plane node in "minikube" cluster
π Pulling base image v0.0.44 ...
π₯ Creating docker container (CPUs=2, Memory=2600MB) ...
π³ Preparing Kubernetes v1.30.0 on Docker 26.1.1 ...
βͺ Generating certificates and keys ...
βͺ Booting up control plane ...
βͺ Configuring RBAC rules ...
π Configuring CNI (Container Networking Interface) ...
π Verifying Kubernetes components...
βͺ Using image gcr.io/k8s-minikube/storage-provisioner:v5
π Enabled addons: storage-provisioner, default-storageclass
π Starting "minikube-m02" worker node in "minikube" cluster
π Pulling base image v0.0.44 ...
π₯ Creating docker container (CPUs=2, Memory=2600MB) ...
π Found network options:
βͺ NO_PROXY=192.168.49.2
π³ Preparing Kubernetes v1.30.0 on Docker 26.1.1 ...
βͺ env NO_PROXY=192.168.49.2
π Verifying Kubernetes components...
π Starting "minikube-m03" worker node in "minikube" cluster
π Pulling base image v0.0.44 ...
π₯ Creating docker container (CPUs=2, Memory=2600MB) ...
π Found network options:
βͺ NO_PROXY=192.168.49.2,192.168.49.3
π³ Preparing Kubernetes v1.30.0 on Docker 26.1.1 ...
βͺ env NO_PROXY=192.168.49.2
βͺ env NO_PROXY=192.168.49.2,192.168.49.3
π Verifying Kubernetes components...
π Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
$ kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
minikube Ready control-plane 83s v1.30.0 192.168.49.2 <none> Ubuntu 22.04.4 LTS 6.8.0-39-generic docker://26.1.1
minikube-m02 Ready <none> 62s v1.30.0 192.168.49.3 <none> Ubuntu 22.04.4 LTS 6.8.0-39-generic docker://26.1.1
minikube-m03 Ready <none> 53s v1.30.0 192.168.49.4 <none> Ubuntu 22.04.4 LTS 6.8.0-39-generic docker://26.1.1
We can see Minikubeβs internal DaemonSets using the -A
flag:
kubectl get ds -A
NAMESPACE NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
kube-system kindnet 3 3 3 3 3 <none> 98s
kube-system kube-proxy 3 3 3 3 3 kubernetes.io/os=linux 99s
To see pod details for the kindnet
DaemonSet:
$ kubectl get pod -o wide --selector=app=kindnet -A
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
kube-system kindnet-7pdfx 1/1 Running 0 9m18s 192.168.49.2 minikube <none> <none>
kube-system kindnet-b4n7g 1/1 Running 0 9m4s 192.168.49.4 minikube-m03 <none> <none>
kube-system kindnet-r9hsh 1/1 Running 0 9m13s 192.168.49.3 minikube-m02 <none> <none>
We can confirm that one kindnet
pod is running on each node.
8.1. Example YAML fileο
fluentd is a tool for data log aggregation and processing.
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: fluentd-agent
namespace: default
labels:
k8s-app: fluentd-agent
spec:
selector:
matchLabels:
k8s-app: fluentd-agent
template:
metadata:
labels:
k8s-app: fluentd-agent
spec:
containers:
- name: fluentd
image: quay.io/fluentd_elasticsearch/fluentd:v4.9.0
Right click > βOpen image in new tabβ to view full-size.ο