Skip to content

Does Not Consolidate On-Demand Nodes Back to Spot When Capacity Stabilizes #7832

Open
@sai9920

Description

@sai9920

Description

Observed Behavior:

Once on-demand nodes are created due to capacity constraints, they remain in the cluster even after spot capacity becomes available. Karpenter does not automatically replace on-demand nodes with spot instances when conditions improve. Instead, manual intervention (draining the nodes) is required to trigger the transition back to spot instances.

As a result, when spot capacity runs out, the workload shifts to on-demand nodes, but it never moves back to spot instances even after the spot capacity is restored.

`  - name: default
    expireAfter: 720h
    terminationGracePeriod: 5m
    nodeClass: default
    taints:
      - key: default
        effect: NoSchedule
    labels:
      usage: default
    instanceRequirements:
    - key: "node.kubernetes.io/instance-type"
      operator: In
      values:
      - c6i.8xlarge
      - c6i.12xlarge
      - c6i.16xlarge
      - c7i.8xlarge
      - c7i.12xlarge
      - c7i.16xlarge
      - c7a.8xlarge
      - c7a.12xlarge
      - c7a.16xlarge
      - c6a.8xlarge
      - c6a.12xlarge
      - c6a.16xlarge
      - c6in.8xlarge
      - c6id.8xlarge
      - c6id.12xlarge
      - c6id.12xlarge
    - key: "topology.kubernetes.io/zone"
      operator: In
      values:
      - ap-southeast-1b
      - ap-southeast-1a
      - ap-southeast-1c
    - key: "kubernetes.io/arch"
      operator: In
      values:
      - amd64
    - key: "karpenter.sh/capacity-type"
      operator: In
      values:
      - spot
      - on-demand
    disruptionConfig:
      consolidationPolicy: WhenEmptyOrUnderutilized
      consolidateAfter: 300s
      budgets:
      - nodes: "50%"
    weight: 12
    limits:
      cpu: 5k
      memory: 4Ti`

Expected Behavior:

Karpenter should automatically consolidate and replace on-demand nodes with spot instances when they become available, optimizing cost efficiency.

Reproduction Steps (Please include YAML):

1.	Deploy Karpenter with the following node pool configuration, which supports both on-demand and spot instances.
2.	Simulate a scenario where spot capacity runs out, causing Karpenter to provision on-demand instances.
3.	Allow spot capacity to become available again.
4.	Observe that Karpenter does not consolidate on-demand instances and replace them with spot instances automatically.

Versions: 1.0.6

  • Chart Version: 1.0.6
  • Kubernetes Version (kubectl version): 1.31
  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage/needs-informationMarks that the issue still needs more information to properly triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions