kubernetes/kops · error

error creating LB: %v

Error message

error creating LB: %v

What it means

kOps failed at the Octavia load balancer create API call (t.Cloud.CreateLB) after resolving the VIP subnet. The wrapped gophercloud error carries the real cause (quota, auth, Octavia unavailable, invalid flavor, etc.).

Source

Thrown at upup/pkg/fi/cloudup/openstacktasks/lb.go:217

			Name: fi.ValueOf(e.Subnet),
		})
		if err != nil {
			return fmt.Errorf("Failed to retrieve subnet `%s` in loadbalancer creation: %v", fi.ValueOf(e.Subnet), err)
		}
		if len(subnets) != 1 {
			return fmt.Errorf("Unexpected desired subnets for `%s`.  Expected 1, got %d", fi.ValueOf(e.Subnet), len(subnets))
		}

		lbopts := loadbalancers.CreateOpts{
			Name:        fi.ValueOf(e.Name),
			VipSubnetID: subnets[0].ID,
		}
		if e.FlavorID != nil {
			lbopts.FlavorID = fi.ValueOf(e.FlavorID)
		}
		lb, err := t.Cloud.CreateLB(lbopts)
		if err != nil {
			return fmt.Errorf("error creating LB: %v", err)
		}
		e.ID = new(lb.ID)
		e.PortID = new(lb.VipPortID)
		e.VipSubnet = new(lb.VipSubnetID)
		e.Provider = new(lb.Provider)
		e.FlavorID = new(lb.FlavorID)

		if e.SecurityGroup != nil {
			opts := ports.UpdateOpts{
				SecurityGroups: &[]string{fi.ValueOf(e.SecurityGroup.ID)},
			}
			_, err = ports.Update(context.TODO(), t.Cloud.NetworkingClient(), lb.VipPortID, opts).Extract()
			if err != nil {
				return fmt.Errorf("Failed to update security group for port %s: %v", lb.VipPortID, err)
			}
		}
		return nil
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Read the wrapped %v cause in the kops log to identify the API error (403/404/409/413 etc.)
  2. Verify Octavia is installed and listed in `openstack service list` and that the k8s cluster config uses the octavia provider
  3. Check load balancer quota with `openstack quota show` and delete unused LBs or raise the quota
  4. If flavorID is set in the spec, validate it against `openstack loadbalancer flavor list`
Defensive patterns

Strategy: retry

Validate before calling

// Pre-flight: confirm Octavia is available and quota allows one more LB
openstack loadbalancer list >/dev/null && echo octavia-ok
openstack quota show -f value | grep -i 'load_balancers'

Try / catch

err := t.Cloud.CreateLB(lbopts)
if err != nil {
    var gerr gophercloud.ErrUnexpectedResponseCode
    if errors.As(err, &gerr) && (gerr.StatusCode == 429 || gerr.StatusCode >= 500) {
        // transient: backoff and retry
        return retry.After(backoff, err)
    }
    return fmt.Errorf("error creating LB: %w", err) // permanent: fail fast
}

Prevention

When it happens

Trigger: CreateLB(lbopts) returns an error during `kops update cluster` — e.g. Octavia service not present in the catalog, load balancer quota exceeded, flavor_id invalid, or the chosen subnet's network cannot host a VIP.

Common situations: Cluster deployed in a cloud/region without Octavia installed; octavia quota 'load_balancer' exhausted; user passed an invalid loadBalancer flavor in config; neutron network disabled for VIP allocation.

Related errors


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