Skip to main content
This lesson reviews Kubernetes DaemonSets, inspects existing DaemonSets in the cluster, and shows how to deploy a simple fluentd DaemonSet for cluster logging.

1) How many DaemonSets exist in the cluster (all namespaces)?

Run:
Sample output from the cluster used for this lesson:
From the sample output above there are two DaemonSets:
  • kube-flannel-ds
  • kube-proxy
Summary table (quick reference):

2) Which namespace are the DaemonSets created in?

Check the NAMESPACE column in the kubectl get ds -A output: both DaemonSets in this example are in the kube-system namespace.

3) Which of the following are DaemonSets?

From the items shown in this cluster:
  • kube-flannel-ds — DaemonSet
  • kube-proxy — DaemonSet
Other components you might see in a cluster—such as kube-scheduler, coredns, etcd-master—are not DaemonSets in this example.

4) On how many nodes are the pods scheduled by the kube-proxy DaemonSet?

Describe the DaemonSet (note use of singular resource name):
Relevant excerpt:
This DaemonSet reports Desired Number of Nodes Scheduled: 1 and Current Number of Nodes Scheduled: 1, so the DaemonSet is scheduled on a single node in this cluster. To confirm the cluster node count:
Sample output:
Because this example cluster has a single node, a DaemonSet configured to run on all matching nodes results in one pod per DaemonSet (one per node).

5) What image does the kube-flannel-ds DaemonSet use?

Describe the flannel DaemonSet:
Excerpt showing init container and main container images:
In this example, the kube-flannel-ds DaemonSet uses quay.io/coreos/flannel:v0.13.1-rc1 for both its init container and the flannel container.

6) Deploy a DaemonSet for fluentd logging

Below is a straightforward DaemonSet manifest that runs fluentd on each node in the kube-system namespace. It includes a toleration so pods can be scheduled on master nodes; remove the toleration if you do not want to run logging pods on control-plane nodes.
Warning: running daemon pods on control-plane nodes can affect cluster stability or security. Ensure you understand tolerations and node roles before scheduling logging agents on master/control-plane nodes.
This DaemonSet manifest is a minimal example for demonstration. For production you should add RBAC rules, a ConfigMap for fluentd configuration, proper volume permissions, and node selectors/affinity as required.
Two practical ways to obtain or author this manifest:
  • Save the YAML above to a file and apply it directly:
  • Or generate a starting YAML with kubectl and edit it into a DaemonSet:
Then edit fluentd.yaml:
  • Change kind: Deployment to kind: DaemonSet.
  • Remove replicas: and any strategy: entries (DaemonSets don’t use replicas).
  • Add tolerations, volume mounts, and volumes: for host log paths as required.
  • Save and apply:
Sample apply result:
If your kubectl or cluster tooling doesn’t include a direct kubectl create daemonset subcommand, generate YAML with kubectl create --dry-run=client -o yaml and edit it into a DaemonSet manifest, or simply apply a prepared manifest with kubectl apply -f.
This example demonstrates the basic DaemonSet pattern for running a logging agent on every node. For production readiness, extend it with configuration management, RBAC, security contexts, resource tuning, and node affinity.

Watch Video