DaemonSets
TOC
Understanding DaemonSets
Refer to the official Kubernetes documentation: DaemonSets
A DaemonSet is a Kubernetes controller that ensures all (or a subset of) cluster nodes run exactly one replica of a specified Pod. Unlike Deployments, DaemonSets are node-centric rather than application-centric, making them ideal for deploying cluster-wide infrastructure services such as log collectors, monitoring agents, or storage daemons.
DaemonSet Operational Notes
-
Behavior Characteristics
-
Pod Distribution: A DaemonSet deploys exactly one Pod replica per schedulable Node that matches its criteria:
- Deploys exactly one Pod replica per schedulable node matching:
- Matches
nodeSelectorornodeAffinitycriteria (if specified). - Is not in the
NotReadystate. - Does not have
NoScheduleorNoExecuteTaints unless corresponding Tolerations are configured in the Pod Template.
- Matches
- Deploys exactly one Pod replica per schedulable node matching:
-
Pod Count Formula: The number of Pods managed by a DaemonSet equals the number of qualified Nodes.
-
Dual-Role Node Handling: Nodes serving both Control Plane and Worker Node roles will only run one Pod instance of the DaemonSet, regardless of their role labels, provided they are schedulable.
-
-
Key Constraints (Excluded Nodes)
- Nodes explicitly marked
Unschedulable: true(e.g., viakubectl cordon). - Nodes with a
NotReadystatus. - Nodes having incompatible Taints without matching Tolerations configured in the DaemonSet's Pod Template.
- Nodes explicitly marked
Creating DaemonSets
Creating a DaemonSet by using CLI
Prerequisites
- Ensure you have
kubectlconfigured and connected to your cluster.
YAML file example
Creating a DaemonSet via YAML
Creating a DaemonSet by using web console
Prerequisites
Obtain the image address. The source of the images can be from the image repository integrated by the platform administrator through the toolchain or from third-party platforms' image repositories.
-
For the former, the Administrator typically assigns the image repository to your project, and you can use the images within it. If the required image repository is not found, please contact the Administrator for allocation.
-
If it is a third-party platform's image repository, ensure that images can be pulled directly from it in the current cluster.
Procedure - Configure Basic Info
-
Container Platform, navigate to Workloads > DaemonSets in the left sidebar.
-
Click Create DaemonSet.
-
Select or Input an image, and click Confirm.
Note: When using images from the image repository integrated into web console, you can filter images by Already Integrated. The Integration Project Name, for example, images (docker-registry-projectname), which includes the project name projectname in this web console and the project name containers in the image repository.
In the Basic Info section, configure declarative parameters for DaemonSet workloads:
Procedure - Configure Pod
Pod section, please refer to Deployment - Configure Pod
Procedure - Configure Containers
Containers section, please refer to Deployment - Configure Containers
Procedure - Create
Click Create.
After clicking Create, the DaemonSet will:
-
✅ Automatically deploy Pod replicas to all eligible Nodes meeting:
nodeSelectorcriteria (if defined).tolerationsconfiguration (allowing scheduling on tainted nodes).- Node is in
Readystate andSchedulable: true.
-
❌ Excluded Nodes:
- Nodes with a
NoScheduletaint (unless explicitly tolerated). - Manually cordoned Nodes (
kubectl cordon). - Nodes in
NotReadyorUnschedulablestates.
- Nodes with a
Managing DaemonSets
Managing a DaemonSet by using CLI
Viewing a DaemonSet
-
To get a summary of all DaemonSets in a namespace.
-
To get detailed information about a specific DaemonSet, including its events and Pod status
Updating a DaemonSet
When you modify the Pod Template of a DaemonSet (e.g., changing the container image or adding a volume mount), Kubernetes automatically performs a rolling update by default (if updateStrategy.type is RollingUpdate, which is the default).
-
First, edit the YAML file (e.g.,
example-daemonset.yaml) with the desired changes, then apply it: -
You can monitor the progress of the rolling update:
Deleting a DaemonSet
To delete a DaemonSet and all the Pods it manages:
Managing a DaemonSet by using web console
Viewing a DaemonSet
- Container Platform, and navigate to Workloads > DaemonSets.
- Locate the DaemonSet you wish to view.
- Click the DaemonSet name to see the Details, Topology, Logs, Events, Monitoring, etc.
Updating a DaemonSet
- Container Platform, and navigate to Workloads > DaemonSets.
- Locate the DaemonSet you wish to update.
- In the Actions drop-down menu, select Update to view the Edit DaemonSet page, you can update
Replicas,image,updateStrategy, etc.
Deleting a DaemonSet
- Container Platform, and navigate to Workloads > DaemonSets.
- Locate the DaemonSet you wish to delete.
- In the Actions drop-down menu, Click the Delete button in the operations column and confirm.