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
- 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.
- Verify keystone credentials and that the project has access to the load balancer (`openstack loadbalancer stats <id>`).
- Confirm the Octavia service is healthy in the cloud region.
- 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
- Confirm the LB exists before polling stats; handle 404 as 'gone' not fatal.
- Grant the project viewer access to Octavia resources.
- Poll stats at modest intervals; the helper already retries via readBackoff.
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
- failed to create pool: %v
- failed to build load balancer client: %w
- cluster configured to use octavia, but router was not config
- error building lb client: %w
- loadbalancer API versions not found
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/db63944f390066b6.
Report an issue: GitHub.