kubernetes/kops · error

error building lb client: %w

Error message

error building lb client: %w

What it means

Wraps a failure from openstack.NewLoadBalancerV2 (gophercloud Octavia v2 client) used when the cluster is configured for Octavia. Client construction fails when the 'load-balancer' service endpoint cannot be found for the region or auth fails.

Source

Thrown at upup/pkg/fi/cloudup/openstack/cloud.go:501

		if spec.Loadbalancer.UseOctavia != nil {
			octavia = fi.ValueOf(spec.Loadbalancer.UseOctavia)
		}
		if spec.Loadbalancer.FloatingSubnet != nil {
			c.floatingSubnet = spec.Loadbalancer.FloatingSubnet
		}
	} else if fi.ValueOf(spec.Loadbalancer.UseOctavia) {
		return fmt.Errorf("cluster configured to use octavia, but router was not configured")
	}
	c.useOctavia = octavia

	var lbClient *gophercloud.ServiceClient
	if octavia {
		klog.V(2).Infof("Openstack using Octavia lbaasv2 api")
		client, err := openstack.NewLoadBalancerV2(provider, gophercloud.EndpointOpts{
			Region: region,
		})
		if err != nil {
			return fmt.Errorf("error building lb client: %w", err)
		}
		lbClient = client
	} else {
		klog.V(2).Infof("Openstack using deprecated lbaasv2 api")
		client, err := openstack.NewNetworkV2(provider, gophercloud.EndpointOpts{
			Region: region,
		})
		if err != nil {
			return fmt.Errorf("error building lb client: %w", err)
		}
		lbClient = client
	}
	c.lbClient = lbClient
	return nil
}

// UseZones add unique zone names to openstackcloud
func (c *openstackCloud) UseZones(zones []string) {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Verify octavia endpoint: 'openstack endpoint list --service load-balancer' in the target region
  2. Fix the region in the cluster spec / OS_REGION_NAME
  3. Check service type is registered as 'load-balancer' (or adjust catalog)
  4. Re-authenticate with valid OS_* credentials and confirm 'openstack loadbalancer list' succeeds

Example fix

// before: region without octavia
Region: "aux-region"
// after
Region: "main-region" // where 'openstack endpoint list' shows the octavia endpoint
Defensive patterns

Strategy: validation

Validate before calling

// pre-flight: resolve the octavia endpoint for the region
ep, err := provider.GetEndpoint("load-balancer", gophercloud.EndpointOpts{Region: region})
if err != nil { return fmt.Errorf("octavia unavailable in %s: %w", region, err) }

Try / catch

// go
if err != nil && strings.Contains(err.Error(), "error building lb client") {
    klog.Errorf("ensure octavia endpoint exists in region %s", region)
}

Prevention

When it happens

Trigger: octavia==true path in buildLoadBalancerClient: NewLoadBalancerV2(provider, EndpointOpts{Region:region}) errors — no octavia endpoint in the catalog, wrong region, or token/auth error.

Common situations: Octavia not deployed in the cloud; region mismatch; Keystone catalog using a non-standard service type so EndpointOpts{Type:'load-balancer'} misses; credentials lacking LB access.

Related errors


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