kubernetes/kops · error

Error getting load balancer stats %v

Error message

Error getting load balancer stats %v

What it means

Thrown when `loadbalancers.GetStats(...).Extract()` fails inside a RetryWithBackoff loop while fetching Octavia load balancer statistics. The gophercloud GetStats call either returned a non-2xx HTTP response or its payload could not be extracted. It is retried with backoff, so the surfaced error is the last attempt's failure.

Source

Thrown at upup/pkg/fi/cloudup/openstack/loadbalancer.go:303

		}
		return lbs, err
	}
	return lbs, nil
}

func (c *openstackCloud) GetLBStats(loadbalancerID string) (stats *loadbalancers.Stats, err error) {
	return getLBStats(c, loadbalancerID)
}

func getLBStats(c OpenstackCloud, loadbalancerID string) (stats *loadbalancers.Stats, err error) {
	if c.LoadBalancerClient() == nil {
		return stats, nil
	}

	done, err := vfs.RetryWithBackoff(readBackoff, func() (bool, error) {
		stats, err = loadbalancers.GetStats(context.TODO(), c.LoadBalancerClient(), loadbalancerID).Extract()
		if err != nil {
			return false, fmt.Errorf("Error getting load balancer stats %v", err)
		}
		return true, nil
	})
	if !done {
		if err == nil {
			err = wait.ErrWaitTimeout
		}
		return stats, err
	}
	return stats, nil
}

func (c *openstackCloud) GetPool(poolID string) (pool *v2pools.Pool, err error) {
	return getPool(c, poolID)
}

func getPool(c OpenstackCloud, poolID string) (pool *v2pools.Pool, err error) {
	if c.LoadBalancerClient() == nil {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the wrapped %v error for the HTTP status: 404 means the LB ID is stale/being deleted and the caller should treat it as gone.
  2. Verify keystone credentials and that the project has access to the load balancer (`openstack loadbalancer stats <id>`).
  3. Confirm the Octavia service is healthy in the cloud region.
  4. Rely on the built-in readBackoff retry; if timeouts persist, increase backoff or poll less frequently.
Defensive patterns

Strategy: retry

Validate before calling

lb, err := cloud.GetLoadbalancer(loadbalancerID)
if err != nil || lb == nil {
	return fmt.Errorf("loadbalancer %s not accessible, skip stats", loadbalancerID)
}

Try / catch

stats, err := cloud.GetLoadbalancerStats(id)
if err != nil {
	if strings.Contains(err.Error(), "404") || strings.Contains(err.Error(), "Not Found") {
		klog.V(2).Infof("LB %s deleted; treating stats as zero", id)
		return defaultStats, nil
	}
	return retryStatsWithBackoff(id) // surface only after retries exhausted
}

Prevention

When it happens

Trigger: Calling GetLoadbalancerStats with a loadbalancerID for a load balancer that no longer exists (404), the Octavia service is down (5xx), or the project lacks credentials/permissions to view stats.

Common situations: A cluster being deleted concurrently while stats are polled; IAM/keystone role missing the octavia viewer role; Octavia API outage or timeouts in a busy cloud.

Related errors


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