kubernetes/kops · error
error building load balancers: %v
Error message
error building load balancers: %v
What it means
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.
Source
Thrown at pkg/model/awsmodel/spotinst.go:311
group.Tenancy = new(ig.Spec.Tenancy)
}
// Security groups.
group.SecurityGroups, err = b.buildSecurityGroups(c, ig)
if err != nil {
return fmt.Errorf("error building security groups: %v", err)
}
// SSH key.
group.SSHKey, err = b.LinkToSSHKey()
if err != nil {
return fmt.Errorf("error building ssh key: %v", err)
}
// Load balancers.
group.LoadBalancers, group.TargetGroups, err = b.buildLoadBalancers(c, ig)
if err != nil {
return fmt.Errorf("error building load balancers: %v", err)
}
// User data.
group.UserData, err = b.BootstrapScriptBuilder.ResourceNodeUp(c, ig)
if err != nil {
return fmt.Errorf("error building user data: %v", err)
}
// Public IP.
group.AssociatePublicIPAddress, err = b.buildPublicIPOpts(ig)
if err != nil {
return fmt.Errorf("error building public ip options: %v", err)
}
// Subnets.
group.Subnets, err = b.buildSubnets(ig)
if err != nil {
return fmt.Errorf("error building subnets: %v", err)View on GitHub (pinned to 4c8573c808)
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.
Example fix
// before externalLoadBalancers: - loadBalancerName: nonexistent-elb // after externalLoadBalancers: - loadBalancerName: my-existing-elb
Defensive patterns
Strategy: validation
Validate before calling
for _, lb := range ig.Spec.ExternalLoadBalancers {
if lb.LoadBalancerName == nil || *lb.LoadBalancerName == "" {
return fmt.Errorf("instance group %s has an external load balancer without a name", ig.Name)
}
} Try / catch
if err := kopsUpdate(); err != nil {
if strings.Contains(err.Error(), "error building load balancers") {
// fix externalLoadBalancers / api.loadBalancer spec and retry
}
} Prevention
- 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.
When it happens
Trigger: `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.
Common situations: 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).
Related errors
- spotinst: load balancer %q has no LoadBalancerName
- error deregistering instance %q, node %q: %w
- unknown load balancer Type: %q
- unhandled bastion LoadBalancer type %q
- error building ssh key: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/c6e87299c55e0060.
Report an issue: GitHub.