kubernetes/kops · error

failed to get info for load balancer %q: %w

Error message

failed to get info for load balancer %q: %w

What it means

GetApiIngressStatus looks up the cluster's API load balancer by name ("api.<cluster>") via LoadBalancerClient.GetByName. If that Hetzner API call errors (network, auth, API failure), the error is wrapped with the LB name. This is not the same as the LB not existing — a nil lb with nil error returns gracefully.

Source

Thrown at upup/pkg/fi/cloudup/hetzner/cloud.go:441

// FindVPCInfo is not implemented
func (c *hetznerCloudImplementation) FindVPCInfo(id string) (*fi.VPCInfo, error) {
	// TODO(hakman): Implement me
	return nil, errors.New("hetzner cloud provider does not implement FindVPCInfo at this time")
}

// FindClusterStatus was used before etcd-manager to check the etcd cluster status and prevent unsupported changes.
func (c *hetznerCloudImplementation) FindClusterStatus(cluster *kops.Cluster) (*kops.ClusterStatus, error) {
	return nil, nil
}

func (c *hetznerCloudImplementation) GetApiIngressStatus(cluster *kops.Cluster) ([]fi.ApiIngressStatus, error) {
	lbName := "api." + cluster.Name

	client := c.LoadBalancerClient()
	lb, _, err := client.GetByName(context.TODO(), lbName)
	if err != nil {
		return nil, fmt.Errorf("failed to get info for load balancer %q: %w", lbName, err)
	}
	if lb == nil {
		return nil, nil
	}

	if !lb.PublicNet.Enabled {
		return nil, fmt.Errorf("load balancer %s(%d) is not public", lb.Name, lb.ID)
	}

	ingresses := []fi.ApiIngressStatus{
		{
			IP: lb.PublicNet.IPv4.IP.String(),
		},
	}

	return ingresses, nil
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the wrapped error: 401 => fix HCLOUD_TOKEN, timeout => check network/proxy.
  2. Verify token with `curl -H "Authorization: Bearer $HCLOUD_TOKEN" https://api.hetzner.cloud/v1/load_balancers`.
  3. Retry after transient failures.
  4. If the LB was intentionally deleted, recreate it via `kops update cluster`.
Defensive patterns

Strategy: retry

Validate before calling

resp, _ := http.Get("https://api.hetzner.cloud/v1") // plus token auth check before running
if resp.StatusCode == 401 { /* fix token first */ }

Try / catch

lb, _, err := client.GetByName(ctx, lbName)
if err != nil {
  var hErr *hcloud.ErrorResponse
  if errors.As(err, &hErr) && hErr.Code == "rate_limit_exceeded" {
    // back off and retry
  }
  return nil, fmt.Errorf("failed to get info for load balancer %q: %w", lbName, err)
}

Prevention

When it happens

Trigger: The hcloud LoadBalancer GetByName request fails: invalid HCLOUD_TOKEN, network timeout, rate limit, or Hetzner API 5xx.

Common situations: Expired/incorrect API token during `kops rolling-update` or `kops validate`; Hetzner API outage; corporate proxy blocking api.hetzner.cloud.

Related errors


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