kubernetes/kops · error
can't build elastigroup while nodeTerminationHandler flag is
Error message
can't build elastigroup while nodeTerminationHandler flag is on. using nodeTerminationHandler will interfere with Ocean Kubernetes controller . Please add the following configuration to cluster config nodeTerminationHandler: enabled: false
What it means
Error "can't build elastigroup while nodeTerminationHandler flag is on. using nodeTerminationHandler will interfere with Ocean Kubernetes controller . Please add the following configuration to cluster config nodeTerminationHandler: enabled: false " thrown in kubernetes/kops.
Source
Thrown at pkg/model/awsmodel/spotinst.go:227
func (b *SpotInstanceGroupModelBuilder) buildElastigroup(c *fi.CloudupModelBuilderContext, ig *kops.InstanceGroup) (err error) {
klog.V(4).Infof("Building instance group as Elastigroup: %q", b.AutoscalingGroupName(ig))
group := &spotinsttasks.Elastigroup{
Lifecycle: b.Lifecycle,
Name: new(b.AutoscalingGroupName(ig)),
Region: new(b.Region),
ImageID: new(ig.Spec.Image),
OnDemandInstanceType: new(strings.Split(ig.Spec.MachineType, ",")[0]),
SpotInstanceTypes: strings.Split(ig.Spec.MachineType, ","),
}
// Cloud config.
if aws := b.Cluster.Spec.CloudProvider.AWS; aws != nil {
group.Product = aws.SpotinstProduct
group.Orientation = aws.SpotinstOrientation
nth := aws.NodeTerminationHandler
if nth != nil && nth.Enabled != nil && *nth.Enabled {
return fmt.Errorf("can't build elastigroup while nodeTerminationHandler flag is on. " +
"using nodeTerminationHandler will interfere with Ocean Kubernetes controller .\n" +
"Please add the following configuration to cluster config \n nodeTerminationHandler:\n enabled: false ")
}
}
// Strategy.
for k, v := range ig.ObjectMeta.Labels {
switch k {
case SpotInstanceGroupLabelSpotPercentage:
group.SpotPercentage, err = parseFloat(v)
if err != nil {
return err
}
case SpotInstanceGroupLabelOrientation:
group.Orientation = new(v)
case SpotInstanceGroupLabelUtilizeReservedInstances:View on GitHub (pinned to 4c8573c808)
Solutions
- Disable the node termination handler: set nodeTerminationHandler.enabled=false under cloudProvider.aws in the cluster config
- Alternatively disable the SpotInst Ocean feature flag if the node termination handler is required
- Apply with kops update cluster and a rolling update
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/model/awsmodel/spotinst.go:227 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/2073f95092ef63c8.
Report an issue: GitHub.