kubernetes/kops · error

finding server group task for instance group %q: %w

Error message

finding server group task for instance group %q: %w

What it means

HCloudClusterConfig builds the Hetzner cloud-controller/cluster config per node instance group. It looks up the corresponding ServerGroup task created by the Hetzner model via tf.Task("ServerGroup", ig.Name). If that task lookup fails (task not registered for this instance group), the error wraps the underlying cause.

Source

Thrown at upup/pkg/fi/cloudup/template_functions.go:1193

	type hcloudClusterConfig struct {
		NodeConfigs map[string]hcloudNodeConfig `json:"nodeConfigs,omitempty"`
	}

	config := &hcloudClusterConfig{
		NodeConfigs: map[string]hcloudNodeConfig{},
	}

	for _, ig := range tf.KopsModelContext.InstanceGroups {
		if !ig.Spec.Role.HasNode() {
			continue
		}
		if ig.Spec.Autoscale != nil && !fi.ValueOf(ig.Spec.Autoscale) {
			continue
		}

		task, err := tf.Task("ServerGroup", ig.Name)
		if err != nil {
			return "", fmt.Errorf("finding server group task for instance group %q: %w", ig.Name, err)
		}

		serverGroup, ok := task.(*hetznertasks.ServerGroup)
		if !ok {
			return "", fmt.Errorf("server group task for instance group %q has unexpected type %T", ig.Name, task)
		}

		nodeLabels, err := nodelabels.BuildNodeLabels(tf.Cluster, ig)
		if err != nil {
			return "", fmt.Errorf("building node labels for instance group %q: %w", ig.Name, err)
		}

		userDataBytes, err := fi.ResourceAsBytes(serverGroup.UserData)
		if err != nil {
			return "", fmt.Errorf("reading user-data for instance group %q: %w", ig.Name, err)
		}

		var taints []corev1.Taint

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Ensure the Hetzner model creates a ServerGroup task for every instance group passed to HCloudClusterConfig (check the hetzner model templates).
  2. Skip or filter instance groups (e.g. control-plane) that should not get a ServerGroup.
  3. Upgrade kOps if a recent provider/model change broke task registration.

Example fix

// before
for _, ig := range masterAndNodeGroups { config += hcloudClusterConfig(tf, ig) }
// after
for _, ig := range nodeGroups { config += hcloudClusterConfig(tf, ig) }
Defensive patterns

Strategy: type-guard

Validate before calling

// Go: only call HCloudClusterConfig for groups the Hetzner model provisions
task, err := tf.Task("ServerGroup", ig.Name)
if err != nil {
    klog.V(2).Infof("skipping ig %q: no ServerGroup task (%v)", ig.Name, err)
    continue
}

Type guard

// Go
sg, ok := task.(*hetznertasks.ServerGroup)
if !ok {
    return "", fmt.Errorf("task %q is %T, want *hetznertasks.ServerGroup", ig.Name, task)
}
_ = sg

Prevention

When it happens

Trigger: Generating Hetzner cluster config for an instance group that has no ServerGroup task in the context — e.g. calling the template function for a control-plane/master group, or for a group the Hetzner model did not create a ServerGroup for (autoscale disabled path, wrong ig list).

Common situations: Custom templates omitting the ServerGroup task for a group; invoking HCloudClusterConfig for groups it was not designed for (control-plane groups); template execution order issues where tasks were not yet registered.

Related errors


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