Skip to content

Karpenter disrupting pods with karpenter.sh/do-not-disrupt: "true" annotation #5786

Description

@AleksaC

Description

Observed Behavior:

Karpenter provisioned a node (ip-10-3-166-58.eu-central-1.compute.internal) to schedule two pending pods (runner-6fvcfnjvw-project-335-concurrent-0-jnhl2u9b and runner-6fvcfnjvw-project-335-concurrent-1-1zfg6jd5) only to consolidate the node and evict the pods ~20s later. The pods were annotated with karpenter.sh/do-not-disrupt: "true".

Here are excerpts from karpenter logs and k8s events.

2024-03-05 10:29:54	 {"level":"INFO","time":"2024-03-05T09:29:54.109Z","logger":"controller.nodeclaim.lifecycle","message":"initialized nodeclaim","commit":"596ea97","nodeclaim":"gitlab-runner-overflow-sbdgm","provider-id":"aws:///eu-central-1b/i-026f428dc48c7d1e1","node":"ip-10-3-166-58.eu-central-1.compute.internal"}
2024-03-05 10:30:14	 {"level":"INFO","time":"2024-03-05T09:30:14.357Z","logger":"controller.disruption","message":"disrupting via consolidation delete, terminating 1 candidates ip-10-3-166-58.eu-central-1.compute.internal/t3.large/spot","commit":"596ea97","command-id":"296e8d57-8002-4e62-99fe-951d4bd3bb77"}
2024-03-05 10:30:14	 {"level":"INFO","time":"2024-03-05T09:30:14.823Z","logger":"controller.disruption.queue","message":"command succeeded","commit":"596ea97","command-id":"296e8d57-8002-4e62-99fe-951d4bd3bb77"}
2024-03-05 10:30:14	 {"level":"INFO","time":"2024-03-05T09:30:14.869Z","logger":"controller.node.termination","message":"tainted node","commit":"596ea97","node":"ip-10-3-166-58.eu-central-1.compute.internal"}
2024-03-05 10:30:16	 {"level":"INFO","time":"2024-03-05T09:30:16.489Z","logger":"controller.node.termination","message":"deleted node","commit":"596ea97","node":"ip-10-3-166-58.eu-central-1.compute.internal"}
2024-03-05 10:30:16	 {"level":"INFO","time":"2024-03-05T09:30:16.812Z","logger":"controller.nodeclaim.termination","message":"deleted nodeclaim","commit":"596ea97","nodeclaim":"gitlab-runner-overflow-sbdgm","node":"ip-10-3-166-58.eu-central-1.compute.internal","provider-id":"aws:///eu-central-1b/i-026f428dc48c7d1e1"}
45m         Normal    Scheduled              pod/runner-6fvcfnjvw-project-335-concurrent-0-jnhl2u9b   Successfully assigned gitlab-runner/runner-6fvcfnjvw-project-335-concurrent-0-jnhl2u9b to ip-10-3-166-58.eu-central-1.compute.internal
45m         Normal    Pulling                pod/runner-6fvcfnjvw-project-335-concurrent-0-jnhl2u9b   Pulling image "registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-f5da3c5a"
45m         Normal    Created                pod/runner-6fvcfnjvw-project-335-concurrent-0-jnhl2u9b   Created container init-permissions
45m         Normal    Pulled                 pod/runner-6fvcfnjvw-project-335-concurrent-0-jnhl2u9b   Successfully pulled image "registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-f5da3c5a" in 4.204s (4.204s including waiting)
45m         Normal    Started                pod/runner-6fvcfnjvw-project-335-concurrent-0-jnhl2u9b   Started container init-permissions
45m         Normal    Pulling                pod/runner-6fvcfnjvw-project-335-concurrent-0-jnhl2u9b   Pulling image "node:18-alpine"
45m         Normal    Evicted                pod/runner-6fvcfnjvw-project-335-concurrent-0-jnhl2u9b   Evicted pod

45m         Normal    Scheduled              pod/runner-6fvcfnjvw-project-335-concurrent-1-1zfg6jd5   Successfully assigned gitlab-runner/runner-6fvcfnjvw-project-335-concurrent-1-1zfg6jd5 to ip-10-3-166-58.eu-central-1.compute.internal
45m         Normal    Pulling                pod/runner-6fvcfnjvw-project-335-concurrent-1-1zfg6jd5   Pulling image "registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-f5da3c5a"
45m         Normal    Pulled                 pod/runner-6fvcfnjvw-project-335-concurrent-1-1zfg6jd5   Successfully pulled image "registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-f5da3c5a" in 3.579s (3.579s including waiting)
45m         Normal    Created                pod/runner-6fvcfnjvw-project-335-concurrent-1-1zfg6jd5   Created container init-permissions
45m         Normal    Started                pod/runner-6fvcfnjvw-project-335-concurrent-1-1zfg6jd5   Started container init-permissions
45m         Normal    Pulling                pod/runner-6fvcfnjvw-project-335-concurrent-1-1zfg6jd5   Pulling image "node:18-alpine"
45m         Normal    Evicted                pod/runner-6fvcfnjvw-project-335-concurrent-1-1zfg6jd5   Evicted pod

The two pods were the only thing scheduled on the node other than daemonsets.

I have no reason to believe that the pods got evicted by some other process and karpenter just cleaned up the node afterwards. Because prometheus only got a single scrape of the node metrics I cannot guarantee that there was no node pressure based on that, but it's very unlikely since the pods that were scheduled on the node consume next to no resources and the timespan was very short.

Expected Behavior:

Reproduction Steps (Please include YAML):

I cannot really provide a set of manifests that would reproduce this deterministically as it's the first time this happened in a couple of weeks that this setup has been active.

Here is the NodePool manifest if it helps with anything:

apiVersion: karpenter.sh/v1beta1
kind: NodePool
metadata:
  annotations:
    meta.helm.sh/release-name: gitlab-runner
    meta.helm.sh/release-namespace: gitlab-runner
  labels:
    app.kubernetes.io/managed-by: Helm
  name: gitlab-runner-overflow
spec:
  disruption:
    budgets:
    - nodes: 10%
    consolidationPolicy: WhenUnderutilized
    expireAfter: Never
  limits:
    cpu: "12"
  template:
    spec:
      nodeClassRef:
        name: default
      requirements:
      - key: karpenter.sh/capacity-type
        operator: In
        values:
        - spot
        - on-demand
      - key: kubernetes.io/arch
        operator: In
        values:
        - amd64
      - key: karpenter.k8s.aws/instance-family
        operator: In
        values:
        - t3
      - key: karpenter.k8s.aws/instance-size
        operator: In
        values:
        - medium
        - large
        - xlarge
      - key: kubernetes.io/os
        operator: In
        values:
        - linux
      taints:
      - effect: NoSchedule
        key: gitlab-runner
  weight: 98

It would be helpful if karpenter provided more information in its logs. I glanced at the code to see if maybe there is more useful info if I changed the log level to debug, but couldn't find anything to support that.

Versions:

  • Chart Version: v0.34.1
  • Kubernetes Version (kubectl version): 1.28

  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionIssues that are support related questions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions