kubernetes/kops · error
failed to deregister instance from load balancers: %v
Error message
failed to deregister instance from load balancers: %v
What it means
This error aggregates failures from deregisterInstance, which concurrently drains the instance from all Octavia/Neutron-LB load balancers it is attached to using an errgroup. If any single LB drain fails, eg.Wait() returns and the whole deregistration is reported as failed with this wrapper message.
Source
Thrown at upup/pkg/fi/cloudup/openstack/instance.go:252
kopsName = fmt.Sprintf("%s-%s", clusterName, ig)
}
lbs, err := c.ListLBs(loadbalancers.ListOpts{})
if err != nil {
return err
}
ctx := context.Background()
eg, _ := errgroup.WithContext(ctx)
for i := range lbs {
func(lb loadbalancers.LoadBalancer) {
eg.Go(func() error {
return drainSingleLB(c, lb, instanceName, kopsName)
})
}(lbs[i])
}
if err := eg.Wait(); err != nil {
return fmt.Errorf("failed to deregister instance from load balancers: %v", err)
}
return nil
}
// drainSingleLB will drain single loadbalancer that is attached to instance
func drainSingleLB(c OpenstackCloud, lb loadbalancers.LoadBalancer, instanceName string, kopsName string) error {
oldStats, err := c.GetLBStats(lb.ID)
if err != nil {
return err
}
draining := false
pools, err := c.ListPools(v2pools.ListOpts{
LoadbalancerID: lb.ID,
})
if err != nil {
return errView on GitHub (pinned to 4c8573c808)
Solutions
- Inspect the aggregated %v error to find which LB(s) failed and their underlying cause
- Verify the load balancers still exist with `openstack loadbalancer list`; remove stale LB references from the cluster config if LBs were deleted manually
- Increase the LB drain timeout / reduce concurrency if Octavia is rate-limiting member removals
- Manually remove the member from the LB pool (`openstack loadbalancer member delete`) and retry the kops operation
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-check the instance's LB members before deregistering
for _, lb := range lbs {
members, err := cloud.ListLBMembers(lb)
if err != nil { return fmt.Errorf("cannot inspect LB %s: %w", lb.ID, err) }
_ = members
} Try / catch
err := DeregisterInstance(cloud, instance)
if err != nil {
var agg []string
if strings.Contains(err.Error(), "failed to deregister instance from load balancers") {
// log and continue delete; LB membership is eventually consistent
klog.Warningf("deregistration failed, continuing: %v", err)
}
_ = agg
} Prevention
- Keep LB lifecycle tied to the cluster so LBs are not deleted out-of-band
- Set drain timeouts appropriate for your workload so draining completes
- Monitor Octavia API health before rolling updates
- Manually clean stuck pool members before retrying
When it happens
Trigger: drainSingleLB fails for one or more load balancers: LB not found, member removal API call errors, the instance never becomes fully drained within the drain timeout, or the load balancer API is unavailable.
Common situations: Deleting a instance-group member whose load balancer was already deleted out-of-band; Octavia service down or overloaded; member stuck in draining state exceeding the drain interval configured for the cluster.
Related errors
- error creating PoolMonitor: %v
- failed to build load balancer client: %w
- cluster configured to use octavia, but router was not config
- error building lb client: %w
- loadbalancer API versions not found
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/2b0c78cd3d3e20ea.
Report an issue: GitHub.