Skip to content

CA: nil pointer exception when NodeGroupForNode returns nil without an error #9277

Description

@elmiko

Which component are you using?:

/area cluster-autoscaler

What version of the component are you using?:

Component version: 1.30->1.35

What k8s version are you using (kubectl version)?:

1.30->1.35

What environment is this in?:

clusterapi

What did you expect to happen?:

expect autoscaler to continue operation as normal.

What happened instead?:

the autoscaler crashes with a nil pointer derefence.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x58 pc=0x1dbd7d2]goroutine 217 [running]:
k8s.io/autoscaler/cluster-autoscaler/processors/nodegroupconfig.(*DelegatingNodeGroupConfigProcessor).GetIgnoreDaemonSetsUtilization(0xc000be2360, {0x0?, 0x0?})
    /go/src/k8s.io/autoscaler/cluster-autoscaler/processors/nodegroupconfig/node_group_config_processor.go:113 +0x52
k8s.io/autoscaler/cluster-autoscaler/core/scaledown/actuation.(*Actuator).scaleDownNodeToReport(0xc000634ea0, 0xc00b73e008, 0x0)
    /go/src/k8s.io/autoscaler/cluster-autoscaler/core/scaledown/actuation/actuator.go:313 +0xd8
k8s.io/autoscaler/cluster-autoscaler/core/scaledown/actuation.(*Actuator).deleteAsyncEmpty(0xc000634ea0, {0xc012d4cce0, 0x3, 0xc01d2d8100?})
    /go/src/k8s.io/autoscaler/cluster-autoscaler/core/scaledown/actuation/actuator.go:150 +0x456
k8s.io/autoscaler/cluster-autoscaler/core/scaledown/actuation.(*Actuator).StartDeletion(0xc000634ea0, {0xc01d2d8100, 0xd, 0x10}, {0x3e7b360, 0x0, 0x0})
    /go/src/k8s.io/autoscaler/cluster-autoscaler/core/scaledown/actuation/actuator.go:123 +0x234
k8s.io/autoscaler/cluster-autoscaler/core.(*StaticAutoscaler).RunOnce(0xc0003a80f0, {0x4?, 0xc00055b788?, 0x3e18040?})
    /go/src/k8s.io/autoscaler/cluster-autoscaler/core/static_autoscaler.go:658 +0x32fb
k8s.io/autoscaler/cluster-autoscaler/loop.RunAutoscalerOnce({0x7f06543eb7a0, 0xc0003a80f0}, 0xc000b0f0e0, {0xc257da789066f768?, 0xe109dd7a2c7c?, 0x3e18040?})
    /go/src/k8s.io/autoscaler/cluster-autoscaler/loop/run.go:36 +0x8a
main.run(0xc000b0f0e0, {0x28ecb10, 0xc000521950})
    /go/src/k8s.io/autoscaler/cluster-autoscaler/main.go:620 +0x4c6
main.main.func2({0x0?, 0x0?})
    /go/src/k8s.io/autoscaler/cluster-autoscaler/main.go:712 +0x1f
created by k8s.io/client-go/tools/leaderelection.(*LeaderElector).Run in goroutine 1
    /go/src/k8s.io/autoscaler/cluster-autoscaler/vendor/k8s.io/client-go/tools/leaderelection/leaderelection.go:213 +0xe6

How to reproduce it (as minimally and precisely as possible):

this appears to happen when a node group is unable to return properly from NodeGroupForNode and no error is return either.

Anything else we need to know?:

i believe the solution for this is to fix the code at https://github.com/kubernetes/autoscaler/blob/cluster-autoscaler-release-1.35/cluster-autoscaler/core/scaledown/actuation/actuator.go#L358 so that it will detect when the returned node group is nil and the error is also nil.

this appears to be a valid case, as multiple providers are able to return nil, nil from this call. see:

it's unclear whether the nil, nil return is expected, but it is indeed utilized. we should fix the code accordingly. i plan to bring this up during the SIG office hours on 26 February 2026.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cluster-autoscalerIssues or PRs related to the Cluster Autoscaler componentkind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions