{"record":{"id":"c6e87299c55e0060","repo":"kubernetes/kops","slug":"error-building-load-balancers-v","errorCode":null,"errorMessage":"error building load balancers: %v","messagePattern":"error building load balancers: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/awsmodel/spotinst.go","lineNumber":311,"sourceCode":"\t\tgroup.Tenancy = new(ig.Spec.Tenancy)\n\t}\n\n\t// Security groups.\n\tgroup.SecurityGroups, err = b.buildSecurityGroups(c, ig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error building security groups: %v\", err)\n\t}\n\n\t// SSH key.\n\tgroup.SSHKey, err = b.LinkToSSHKey()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error building ssh key: %v\", err)\n\t}\n\n\t// Load balancers.\n\tgroup.LoadBalancers, group.TargetGroups, err = b.buildLoadBalancers(c, ig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error building load balancers: %v\", err)\n\t}\n\n\t// User data.\n\tgroup.UserData, err = b.BootstrapScriptBuilder.ResourceNodeUp(c, ig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error building user data: %v\", err)\n\t}\n\n\t// Public IP.\n\tgroup.AssociatePublicIPAddress, err = b.buildPublicIPOpts(ig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error building public ip options: %v\", err)\n\t}\n\n\t// Subnets.\n\tgroup.Subnets, err = b.buildSubnets(ig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error building subnets: %v\", err)","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/awsmodel/spotinst.go#L293-L329","documentation":"buildElastigroup calls b.buildLoadBalancers to link classic load balancers / target groups (API ELB, bastion, external LBs) to the Elastigroup. This wrapper is returned when that linking fails, preventing the Spotinst Elastigroup task from being added to the update model.","triggerScenarios":"`kops update cluster` with Spotinst enabled and an instance group whose load-balancer attachments cannot be built: API load-balancer/target-group tasks absent from the context (ig.RunsAPIServer() with UseLoadBalancerForAPI), or an ExternalLoadBalancers entry referencing a load balancer that cannot be linked.","commonSituations":"Node groups with spec.externalLoadBalancers pointing at LB names in another cluster/region; clusters with api.loadBalancer configured but the LB task skipped; mismatched topology (e.g. internal LB with public subnets).","solutions":["Read the wrapped inner error to identify which LB/target-group link failed.","Ensure spec.externalLoadBalancers entries reference existing, shared ELB/NLB names reachable in the cluster's region/VPC.","Verify cluster.spec.api.loadBalancer settings are consistent with the network topology (public/private subnets, type).","Re-run `kops update cluster` after correcting the instance group spec."],"exampleFix":"// before\nexternalLoadBalancers:\n- loadBalancerName: nonexistent-elb\n// after\nexternalLoadBalancers:\n- loadBalancerName: my-existing-elb","handlingStrategy":"validation","validationCode":"for _, lb := range ig.Spec.ExternalLoadBalancers {\n  if lb.LoadBalancerName == nil || *lb.LoadBalancerName == \"\" {\n    return fmt.Errorf(\"instance group %s has an external load balancer without a name\", ig.Name)\n  }\n}","typeGuard":null,"tryCatchPattern":"if err := kopsUpdate(); err != nil {\n  if strings.Contains(err.Error(), \"error building load balancers\") {\n    // fix externalLoadBalancers / api.loadBalancer spec and retry\n  }\n}","preventionTips":["Reference only existing ELB/NLB names in the same VPC/region.","Keep api.loadBalancer settings consistent with public/private topology.","Validate instance group YAML with `kops validate` or schema checks before update."],"tags":["aws","load-balancer","spotinst"],"backgroundTag":"load-balancer-link-failed","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"}