✦ For everyone, free.

Practical knowledge for real and everyday life

Home

Kubernetes DaemonSet Pod Creation Management

Kubernetes DaemonSet ensures consistent pod creation across nodes, managing lifecycle and availability for critical workloads.

Kubernetes DaemonSet Pod Creation Management is the internal process by which the DaemonSet controller decides when and how to create a new Pod for a given node, and the operational implications of that process for anyone deploying or troubleshooting a DaemonSet. Unlike a Deployment, which creates Pods through an intermediate ReplicaSet to satisfy a fixed replica count, a DaemonSet's controller creates Pods directly, one per eligible node, driven entirely by comparing the current set of nodes and their eligibility against the set of nodes that already have a Pod owned by that DaemonSet.

Understanding this creation process — what triggers it, how it is bound to specific nodes, and what can prevent or delay it — is essential for correctly interpreting DaemonSet behavior during cluster scaling events, node maintenance, and initial rollouts.


When Pod Creation Is Triggered

New Node Joining the Cluster

The most common trigger: when a new node registers with the cluster and satisfies the DaemonSet's scheduling constraints (labels, affinity, tolerations) and readiness criteria, the controller creates a Pod for it during its next reconciliation pass, without any explicit action needed from an operator.

DaemonSet Creation on an Existing Cluster

When a brand-new DaemonSet is applied to a cluster that already has running nodes, the controller evaluates every existing node against the new DaemonSet's constraints and creates Pods for every eligible one essentially all at once (subject to normal API server throughput), rather than the more gradual per-node timing seen when nodes join incrementally over time.

Scheduling Constraint Changes

Updating a DaemonSet's nodeSelector or affinity rules to include previously excluded nodes triggers Pod creation on those newly eligible nodes at the next reconciliation, exactly as if those nodes had just joined the cluster.


How Pods Are Bound to Nodes

Direct nodeName Assignment

Unlike ordinary Pods, which are assigned to a node by the Kubernetes scheduler after being created unbound, DaemonSet Pods have historically been created with spec.nodeName already set directly by the DaemonSet controller, bypassing the general scheduler's node-selection logic entirely — the DaemonSet controller already knows exactly which node each Pod belongs to, since that is the entire premise of the controller's design.

Scheduler Still Enforces Resource Fit

Even though the target node is predetermined, the kubelet on that node (and, in modern Kubernetes versions, the default scheduler acting on the DaemonSet Pod through standard scheduling with a node affinity term encoding the target node) still enforces that the Pod's resource requests fit within the node's allocatable capacity — a DaemonSet Pod is not exempt from resource accounting simply because its node was pre-selected, and it can still end up Pending if the target node lacks sufficient free capacity.


Creation Failures and Their Symptoms

Pending Pods Due to Insufficient Resources

A DaemonSet Pod stuck in Pending on a specific node, with an event indicating insufficient CPU or memory, means the node's remaining allocatable capacity has been consumed by other workloads — resolving this requires either freeing capacity on that node or reducing the daemon's own resource requests, since the Pod cannot simply be scheduled elsewhere (there is no "elsewhere" for a DaemonSet Pod; it is that specific node or nothing).

Image Pull Failures

Because DaemonSet Pods are created across potentially many nodes simultaneously, an image pull failure (a private registry rate limit, a network issue affecting a subset of nodes) can manifest as some nodes successfully running the daemon while others sit in ImagePullBackOff, requiring node-by-node investigation rather than assuming a uniform, cluster-wide cause.

Admission Webhook Rejections

Pod creation for a DaemonSet passes through the same admission control pipeline as any other Pod; a validating or mutating webhook that rejects the Pod (due to a security policy violation, for instance) prevents creation on the affected node(s) and surfaces as an event on the DaemonSet rather than a Pod object ever being created at all.

kubectl get events --field-selector reason=FailedCreate --sort-by=.lastTimestamp

Observing the Creation Process

kubectl describe daemonset codartium-log-agent
kubectl get pods -l app=codartium-log-agent -o wide --sort-by=.metadata.creationTimestamp

kubectl describe daemonset surfaces recent Pod creation and failure events directly, making it the first place to look when a DaemonSet appears to be failing to achieve coverage on some subset of nodes.


Example

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: codartium-creation-example
spec:
  selector:
    matchLabels:
      app: codartium-node-agent
  template:
    metadata:
      labels:
        app: codartium-node-agent
    spec:
      containers:
        - name: agent
          image: codartium/node-agent:latest
          resources:
            requests:
              cpu: "50m"
              memory: "64Mi"