kubernetes/kops · error

failed to find server groups: %v

Error message

failed to find server groups: %v

What it means

GetCloudGroups builds cloud instance groups from Hetzner servers grouped by the kops/cluster group label; this error is thrown when findServerGroups fails, which itself wraps GetServers (API list) and label-parsing errors. It prevents kOps from mapping cluster servers to instance groups.

Source

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

	return nil
}

// ProviderID returns the kOps API identifier for Hetzner Cloud
func (c *hetznerCloudImplementation) ProviderID() kops.CloudProviderID {
	return kops.CloudProviderHetzner
}

// Region returns the Hetzner Cloud region
func (c *hetznerCloudImplementation) Region() string {
	return c.region
}

func (c *hetznerCloudImplementation) GetCloudGroups(cluster *kops.Cluster, instanceGroups []*kops.InstanceGroup, warnUnmatched bool, nodes []v1.Node) (map[string]*cloudinstances.CloudInstanceGroup, error) {
	nodeMap := cloudinstances.GetNodeMap(nodes, cluster)

	serverGroups, err := findServerGroups(c, cluster.Name)
	if err != nil {
		return nil, fmt.Errorf("failed to find server groups: %v", err)
	}

	cloudInstanceGroups := make(map[string]*cloudinstances.CloudInstanceGroup)
	for name, serverGroup := range serverGroups {
		var instanceGroup *kops.InstanceGroup
		for _, ig := range instanceGroups {
			groupName := fmt.Sprintf("%s-%s", cluster.Name, ig.Name)
			if name == groupName {
				instanceGroup = ig
				break
			}
		}
		if instanceGroup == nil {
			if warnUnmatched {
				klog.Warningf("Server group %q has no corresponding instance group", name)
			}
			continue
		}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Fix the underlying cause reported by the wrapped error (token, network, rate limit)
  2. Ensure all cluster servers carry the correct kops.k8s.io/instance-group label
  3. Re-apply/repair labels via Hetzner API or recreate affected instances with kOps
  4. Retry the operation once API access is restored
Defensive patterns

Strategy: retry

Validate before calling

// ensure all cluster servers carry the group label before building groups
for _, s := range servers {
	if s.Labels["kops.k8s.io/instance-group"] == "" {
		return fmt.Errorf("server %d missing instance-group label", s.ID)
	}
}

Type guard

var hcloudErr *hcloud.Error
if errors.As(err, &hcloudErr) {
	// distinguish API failures from label-parsing failures
}

Try / catch

groups, err := cloud.GetCloudGroups(cluster, igs, warnUnmatched, nodes)
if err != nil {
	var hErr *hcloud.Error
	if errors.As(err, &hErr) && hErr.Code == hcloud.ErrorCodeRateLimit {
		time.Sleep(hErr.RateLimit.RetryAfter())
		groups, err = cloud.GetCloudGroups(cluster, igs, warnUnmatched, nodes)
	}
}

Prevention

When it happens

Trigger: GetCloudGroups called during validate/rolling-update when the underlying GetServers API call fails (bad token, rate limit, network) or a server's group label cannot be parsed by findServerGroups.

Common situations: Servers missing or having malformed kops.k8s.io/instance-group labels (edited manually in Hetzner console), Hetzner API outages, or invalid credentials during cluster operations.

Related errors


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