{"record":{"id":"2073f95092ef63c8","repo":"kubernetes/kops","slug":"can-t-build-elastigroup-while-nodeterminationhandl","errorCode":null,"errorMessage":"can't build elastigroup while nodeTerminationHandler flag is on. using nodeTerminationHandler will interfere with Ocean Kubernetes controller .\nPlease add the following configuration to cluster config \n nodeTerminationHandler:\n   enabled: false ","messagePattern":"can't build elastigroup while nodeTerminationHandler flag is on\\. using nodeTerminationHandler will interfere with Ocean Kubernetes controller \\.\nPlease add the following configuration to cluster config \n nodeTerminationHandler:\n   enabled: false ","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/awsmodel/spotinst.go","lineNumber":227,"sourceCode":"\nfunc (b *SpotInstanceGroupModelBuilder) buildElastigroup(c *fi.CloudupModelBuilderContext, ig *kops.InstanceGroup) (err error) {\n\tklog.V(4).Infof(\"Building instance group as Elastigroup: %q\", b.AutoscalingGroupName(ig))\n\tgroup := &spotinsttasks.Elastigroup{\n\t\tLifecycle:            b.Lifecycle,\n\t\tName:                 new(b.AutoscalingGroupName(ig)),\n\t\tRegion:               new(b.Region),\n\t\tImageID:              new(ig.Spec.Image),\n\t\tOnDemandInstanceType: new(strings.Split(ig.Spec.MachineType, \",\")[0]),\n\t\tSpotInstanceTypes:    strings.Split(ig.Spec.MachineType, \",\"),\n\t}\n\n\t// Cloud config.\n\tif aws := b.Cluster.Spec.CloudProvider.AWS; aws != nil {\n\t\tgroup.Product = aws.SpotinstProduct\n\t\tgroup.Orientation = aws.SpotinstOrientation\n\t\tnth := aws.NodeTerminationHandler\n\t\tif nth != nil && nth.Enabled != nil && *nth.Enabled {\n\t\t\treturn fmt.Errorf(\"can't build elastigroup while nodeTerminationHandler flag is on. \" +\n\t\t\t\t\"using nodeTerminationHandler will interfere with Ocean Kubernetes controller .\\n\" +\n\t\t\t\t\"Please add the following configuration to cluster config \\n nodeTerminationHandler:\\n   enabled: false \")\n\t\t}\n\t}\n\n\t// Strategy.\n\tfor k, v := range ig.ObjectMeta.Labels {\n\t\tswitch k {\n\t\tcase SpotInstanceGroupLabelSpotPercentage:\n\t\t\tgroup.SpotPercentage, err = parseFloat(v)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\tcase SpotInstanceGroupLabelOrientation:\n\t\t\tgroup.Orientation = new(v)\n\n\t\tcase SpotInstanceGroupLabelUtilizeReservedInstances:","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/awsmodel/spotinst.go#L209-L245","documentation":"Error \"can't build elastigroup while nodeTerminationHandler flag is on. using nodeTerminationHandler will interfere with Ocean Kubernetes controller .\nPlease add the following configuration to cluster config \n nodeTerminationHandler:\n   enabled: false \" thrown in kubernetes/kops.","triggerScenarios":"Thrown at pkg/model/awsmodel/spotinst.go:227 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}