kubernetes/kops · error

deregistering cloud instance %s of group %q: listing load-ba

Error message

deregistering cloud instance %s of group %q: listing load-balancer's back-ends for instance creation: %w

What it means

For each cluster load-balancer, DeregisterInstance lists its back-ends with lbAPI.ListBackends (paged via scw.WithAllPages). Failure is wrapped as "deregistering cloud instance %s of group %q: listing load-balancer's back-ends for instance creation: %w" — note the copy-pasted 'for instance creation' tail from another call site. It means kOps cannot read the back-end pool, so it cannot find and remove the instance's IP.

Source

Thrown at upup/pkg/fi/cloudup/scaleway/cloud.go:278

		return fmt.Errorf("deregistering cloud instance %s of group %q: %w", i.ID, i.CloudInstanceGroup.HumanName, err)
	}
	serverIP, err := s.GetServerIP(server.Server.ID, server.Server.Zone)
	if err != nil {
		return fmt.Errorf("deregistering cloud instance %s of group %q: %w", i.ID, i.CloudInstanceGroup.HumanName, err)
	}

	// We remove the instance's IP from load-balancers
	lbs, err := s.GetClusterLoadBalancers(s.ClusterName(server.Server.Tags))
	if err != nil {
		return fmt.Errorf("deregistering cloud instance %s of group %q: %w", i.ID, i.CloudInstanceGroup.HumanName, err)
	}
	for _, loadBalancer := range lbs {
		backEnds, err := s.lbAPI.ListBackends(&lb.ZonedAPIListBackendsRequest{
			Zone: s.zone,
			LBID: loadBalancer.ID,
		}, scw.WithAllPages())
		if err != nil {
			return fmt.Errorf("deregistering cloud instance %s of group %q: listing load-balancer's back-ends for instance creation: %w", i.ID, i.CloudInstanceGroup.HumanName, err)
		}
		for _, backEnd := range backEnds.Backends {
			for _, ip := range backEnd.Pool {
				if ip == serverIP {
					_, err := s.lbAPI.RemoveBackendServers(&lb.ZonedAPIRemoveBackendServersRequest{
						Zone:      s.zone,
						BackendID: backEnd.ID,
						ServerIP:  []string{serverIP},
					})
					if err != nil {
						return fmt.Errorf("deregistering cloud instance %s of group %q: removing IP from lb: %w", i.ID, i.CloudInstanceGroup.HumanName, err)
					}
				}
			}
		}
	}

	return nil

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the wrapped error code — 404 means the LBID is wrong or the LB was deleted; fix or recreate the LB mapping.
  2. Ensure s.zone matches the load-balancer's zone; zoned LB APIs reject cross-zone requests.
  3. Grant IAM permission to list LB back-ends (lb:read).
  4. Retry if the error is a transient 5xx/throttle from Scaleway.

Example fix

// before: cross-zone ListBackends
Zone: s.zone // nl-ams-1, LB is in fr-par-1
// after
Zone: loadBalancer.Zone // use the LB's own zone
Defensive patterns

Strategy: try-catch

Validate before calling

if loadBalancer.Zone != s.zone {
  return fmt.Errorf("LB %s is in zone %s but client zone is %s; use the LB's own zone", loadBalancer.ID, loadBalancer.Zone, s.zone)
}

Try / catch

backEnds, err := s.lbAPI.ListBackends(&lb.ZonedAPIListBackendsRequest{Zone: s.zone, LBID: loadBalancer.ID}, scw.WithAllPages())
if err != nil {
  var respErr *scw.ResponseError
  if errors.As(err, &respErr) && respErr.StatusCode == 404 {
    klog.Warningf("LB %s or its back-ends no longer exist; skipping", loadBalancer.ID)
    continue
  }
  return fmt.Errorf("listing back-ends for LB %s: %w", loadBalancer.ID, err)
}

Prevention

When it happens

Trigger: lbAPI.ListBackends(&lb.ZonedAPIListBackendsRequest{Zone: s.zone, LBID: loadBalancer.ID}, scw.WithAllPages()) errors: invalid LBID, wrong zone for a zoned LB (multi-AZ cluster where the LB lives in another zone), permission denied, pagination failure, or transient 5xx.

Common situations: Cluster spanning zones where s.zone differs from the LB's zone (ZonedAPI requires the LB's own zone); IAM key missing lb back-end read rights; LB deleted/recreated out-of-band so the cached ID is stale.

Related errors


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