kubernetes/kops · error

NewLBPoolTaskFromCloud: Failed to get lb with id %s: %v

Error message

NewLBPoolTaskFromCloud: Failed to get lb with id %s: %v

What it means

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.

Source

Thrown at upup/pkg/fi/cloudup/openstacktasks/lbpool.go:67

func (s *LBPool) CompareWithID() *string {
	return s.ID
}

func NewLBPoolTaskFromCloud(cloud openstack.OpenstackCloud, lifecycle fi.Lifecycle, pool *v2pools.Pool, find *LBPool) (*LBPool, error) {
	if len(pool.Loadbalancers) > 1 {
		return nil, fmt.Errorf("Openstack cloud pools with multiple loadbalancers not yet supported!")
	}

	a := &LBPool{
		ID:        new(pool.ID),
		Name:      new(pool.Name),
		Lifecycle: lifecycle,
	}
	if len(pool.Loadbalancers) == 1 {
		lbID := pool.Loadbalancers[0]
		lb, err := cloud.GetLB(lbID.ID)
		if err != nil {
			return nil, fmt.Errorf("NewLBPoolTaskFromCloud: Failed to get lb with id %s: %v", lbID.ID, err)
		}
		loadbalancerTask, err := NewLBTaskFromCloud(cloud, lifecycle, lb, nil)
		if err != nil {
			return nil, err
		}
		a.Loadbalancer = loadbalancerTask
	}
	if find != nil {
		// Update all search terms
		find.ID = a.ID
		find.Name = a.Name
	}
	return a, nil
}

func (p *LBPool) Find(context *fi.CloudupContext) (*LBPool, error) {
	if p.Name == nil && p.ID == nil {
		return nil, nil

View on GitHub (pinned to 4c8573c808)

Solutions

  1. 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.
  2. Run `openstack loadbalancer show <lb-id>` to confirm the LB exists and is in your project/region.
  3. Verify credentials/endpoints (openstack token issue, --os-region-name) and retry.
  4. Clean up orphaned pools from deleted LBs in the project so Find stops hitting dead references.

Example fix

// before: state references deleted LB
NewLBPoolTaskFromCloud: Failed to get lb with id lb-123: Resource not found
// after: clean orphan, then recreate
$ openstack loadbalancer pool delete web-pool --wait
$ kops update cluster --name mycluster --yes
Defensive patterns

Strategy: validation

Validate before calling

if _, err := octaviaLBGet(lbID); err != nil {
	if isNotFound(err) {
		return fmt.Errorf("load balancer %s referenced by pool no longer exists; clean up pool and re-run kops update", lbID)
	}
	return err
}

Try / catch

if err := refreshClusterState(); err != nil {
	var notFound gophercloud.ErrDefault404
	if errors.As(err, &notFound) {
		return cleanupOrphanedPoolsAndRetry()
	}
	if isAuthError(err) { return reauthenticateAndRetry() }
	return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/7b48c697cb7a55fe. Report an issue: GitHub.