{"record":{"id":"7b48c697cb7a55fe","repo":"kubernetes/kops","slug":"newlbpooltaskfromcloud-failed-to-get-lb-with-id","errorCode":null,"errorMessage":"NewLBPoolTaskFromCloud: Failed to get lb with id %s: %v","messagePattern":"NewLBPoolTaskFromCloud: Failed to get lb with id (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstacktasks/lbpool.go","lineNumber":67,"sourceCode":"func (s *LBPool) CompareWithID() *string {\n\treturn s.ID\n}\n\nfunc NewLBPoolTaskFromCloud(cloud openstack.OpenstackCloud, lifecycle fi.Lifecycle, pool *v2pools.Pool, find *LBPool) (*LBPool, error) {\n\tif len(pool.Loadbalancers) > 1 {\n\t\treturn nil, fmt.Errorf(\"Openstack cloud pools with multiple loadbalancers not yet supported!\")\n\t}\n\n\ta := &LBPool{\n\t\tID:        new(pool.ID),\n\t\tName:      new(pool.Name),\n\t\tLifecycle: lifecycle,\n\t}\n\tif len(pool.Loadbalancers) == 1 {\n\t\tlbID := pool.Loadbalancers[0]\n\t\tlb, err := cloud.GetLB(lbID.ID)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"NewLBPoolTaskFromCloud: Failed to get lb with id %s: %v\", lbID.ID, err)\n\t\t}\n\t\tloadbalancerTask, err := NewLBTaskFromCloud(cloud, lifecycle, lb, nil)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ta.Loadbalancer = loadbalancerTask\n\t}\n\tif find != nil {\n\t\t// Update all search terms\n\t\tfind.ID = a.ID\n\t\tfind.Name = a.Name\n\t}\n\treturn a, nil\n}\n\nfunc (p *LBPool) Find(context *fi.CloudupContext) (*LBPool, error) {\n\tif p.Name == nil && p.ID == nil {\n\t\treturn nil, nil","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstacktasks/lbpool.go#L49-L85","documentation":"After confirming a pool has exactly one load balancer, NewLBPoolTaskFromCloud fetches that LB with cloud.GetLB(lbID.ID) to build the LBPool's Loadbalancer task. Failure of the GET /v2/lbaas/loadbalancers/{id} call is wrapped here with the LB ID and underlying error.","triggerScenarios":"The referenced load balancer was deleted out-of-band (404), the Octavia API is unreachable, or credentials lack permission to read the LB — any time pool.Loadbalancers[0].ID no longer resolves.","commonSituations":"Stale kops state after an operator deleted the load balancer via OpenStack CLI; Neutron LB ID pointing at an LB in another project; transient auth/endpoint failures ( Keystone token expired, wrong OS_* env vars).","solutions":["Check the wrapped error: if 404, the LB is gone — delete the orphan pool (openstack loadbalancer pool delete) and re-run kops update so it recreates LB+pool.","Run `openstack loadbalancer show <lb-id>` to confirm the LB exists and is in your project/region.","Verify credentials/endpoints (openstack token issue, --os-region-name) and retry.","Clean up orphaned pools from deleted LBs in the project so Find stops hitting dead references."],"exampleFix":"// before: state references deleted LB\nNewLBPoolTaskFromCloud: Failed to get lb with id lb-123: Resource not found\n// after: clean orphan, then recreate\n$ openstack loadbalancer pool delete web-pool --wait\n$ kops update cluster --name mycluster --yes","handlingStrategy":"validation","validationCode":"if _, err := octaviaLBGet(lbID); err != nil {\n\tif isNotFound(err) {\n\t\treturn fmt.Errorf(\"load balancer %s referenced by pool no longer exists; clean up pool and re-run kops update\", lbID)\n\t}\n\treturn err\n}","typeGuard":null,"tryCatchPattern":"if err := refreshClusterState(); err != nil {\n\tvar notFound gophercloud.ErrDefault404\n\tif errors.As(err, &notFound) {\n\t\treturn cleanupOrphanedPoolsAndRetry()\n\t}\n\tif isAuthError(err) { return reauthenticateAndRetry() }\n\treturn err\n}","preventionTips":["Always delete OpenStack load balancer resources through kops (kops delete cluster) so state stays consistent.","Verify OpenStack credentials/region before long-running updates (token expiry).","Periodically sweep the project for orphaned pools/LBs."],"tags":["openstack","octavia","loadbalancer","stale-state"],"backgroundTag":"loadbalancer-not-found","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"}