{"record":{"id":"2b0c78cd3d3e20ea","repo":"kubernetes/kops","slug":"failed-to-deregister-instance-from-load-balancers-2b0c78","errorCode":null,"errorMessage":"failed to deregister instance from load balancers: %v","messagePattern":"failed to deregister instance from load balancers: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstack/instance.go","lineNumber":252,"sourceCode":"\t\tkopsName = fmt.Sprintf(\"%s-%s\", clusterName, ig)\n\t}\n\n\tlbs, err := c.ListLBs(loadbalancers.ListOpts{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tctx := context.Background()\n\teg, _ := errgroup.WithContext(ctx)\n\tfor i := range lbs {\n\t\tfunc(lb loadbalancers.LoadBalancer) {\n\t\t\teg.Go(func() error {\n\t\t\t\treturn drainSingleLB(c, lb, instanceName, kopsName)\n\t\t\t})\n\t\t}(lbs[i])\n\t}\n\n\tif err := eg.Wait(); err != nil {\n\t\treturn fmt.Errorf(\"failed to deregister instance from load balancers: %v\", err)\n\t}\n\n\treturn nil\n}\n\n// drainSingleLB will drain single loadbalancer that is attached to instance\nfunc drainSingleLB(c OpenstackCloud, lb loadbalancers.LoadBalancer, instanceName string, kopsName string) error {\n\toldStats, err := c.GetLBStats(lb.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdraining := false\n\tpools, err := c.ListPools(v2pools.ListOpts{\n\t\tLoadbalancerID: lb.ID,\n\t})\n\tif err != nil {\n\t\treturn err","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstack/instance.go#L234-L270","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-check the instance's LB members before deregistering\nfor _, lb := range lbs {\n    members, err := cloud.ListLBMembers(lb)\n    if err != nil { return fmt.Errorf(\"cannot inspect LB %s: %w\", lb.ID, err) }\n    _ = members\n}","typeGuard":null,"tryCatchPattern":"err := DeregisterInstance(cloud, instance)\nif err != nil {\n    var agg []string\n    if strings.Contains(err.Error(), \"failed to deregister instance from load balancers\") {\n        // log and continue delete; LB membership is eventually consistent\n        klog.Warningf(\"deregistration failed, continuing: %v\", err)\n    }\n    _ = agg\n}","preventionTips":["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"],"tags":["openstack","load-balancer","octavia","deregistration"],"backgroundTag":"load-balancer-deregistration-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"}