Description
Observed Behavior:
We occasionally observe DaemonSet pods remaining Pending with Insufficient cpu or Insufficient memory on newly provisioned Karpenter nodes.
Example scenario:
- A large number of GitLab Runner pods are pending.
- Karpenter computes a node for a workload pod while including the expected DaemonSet overhead.
- Karpenter creates the
NodeClaim and the node joins the cluster.
- The DaemonSet controller creates pods targeting the new node.
- Before those DaemonSet pods are bound,
kube-scheduler schedules other compatible pending GitLab Runner pods onto the node.
- The node no longer has sufficient allocatable resources for one or more DaemonSet pods.
- The DaemonSet pods remain
Pending with Insufficient cpu or Insufficient memory.
We would like to clarify whether this interaction between Karpenter and kube-scheduler is expected.
Specific questions:
- Does Karpenter only use DaemonSet overhead for instance-size calculation, without reserving or protecting that capacity until the DaemonSet pods are scheduled?
- Are pod nomination events expected to influence
kube-scheduler, or are they only used internally by Karpenter?
- Should Karpenter temporarily taint newly provisioned nodes until expected DaemonSets are placed, or is using a custom startup taint the recommended approach?
- What logs, events, or metrics would best confirm whether this scheduling race is occurring?
There also does not appear to be a clear documentation section or diagram describing the full scheduling flow for DaemonSet overhead, including:
- when DaemonSet overhead is calculated;
- whether that capacity is reserved or only used for instance type selection;
- how this interacts with
kube-scheduler;
- how pod nomination events are used;
- what guarantees users should or should not expect.
A documentation clarification and/or diagram would be very helpful.
Expected Behavior:
A node provisioned with DaemonSet overhead included in its resource calculation should have sufficient capacity for all applicable DaemonSet pods and the workload pods for which it was provisioned.
Alternatively, if Karpenter only accounts for DaemonSet overhead during instance type selection and does not reserve that capacity, the documentation should clearly describe this behavior and explain the recommended mitigation.
Reproduction Steps (Please include YAML):
-
Deploy one or more DaemonSets with explicit CPU and memory requests.
-
Create enough workload pods to produce a large pending queue.
-
Ensure the workload pods and DaemonSet pods have equal or similar priorities.
-
Allow Karpenter to provision new nodes for the pending workloads.
-
Compare:
- Karpenter's computed DaemonSet overhead;
- the
NodeClaim resource requests;
- pod creation and binding timestamps;
- the order in which workload pods and DaemonSet pods are bound;
FailedScheduling events for the DaemonSet pods.
Versions:
Description
Observed Behavior:
We occasionally observe DaemonSet pods remaining
PendingwithInsufficient cpuorInsufficient memoryon newly provisioned Karpenter nodes.Example scenario:
NodeClaimand the node joins the cluster.kube-schedulerschedules other compatible pending GitLab Runner pods onto the node.PendingwithInsufficient cpuorInsufficient memory.We would like to clarify whether this interaction between Karpenter and
kube-scheduleris expected.Specific questions:
kube-scheduler, or are they only used internally by Karpenter?There also does not appear to be a clear documentation section or diagram describing the full scheduling flow for DaemonSet overhead, including:
kube-scheduler;A documentation clarification and/or diagram would be very helpful.
Expected Behavior:
A node provisioned with DaemonSet overhead included in its resource calculation should have sufficient capacity for all applicable DaemonSet pods and the workload pods for which it was provisioned.
Alternatively, if Karpenter only accounts for DaemonSet overhead during instance type selection and does not reserve that capacity, the documentation should clearly describe this behavior and explain the recommended mitigation.
Reproduction Steps (Please include YAML):
Deploy one or more DaemonSets with explicit CPU and memory requests.
Create enough workload pods to produce a large pending queue.
Ensure the workload pods and DaemonSet pods have equal or similar priorities.
Allow Karpenter to provision new nodes for the pending workloads.
Compare:
NodeClaimresource requests;FailedSchedulingevents for the DaemonSet pods.Versions: