kubernetes/kops · error

subnet task %q not found for InstanceGroup %q

Error message

subnet task %q not found for InstanceGroup %q

What it means

findSubnetTask scans the model-builder context's task list for a linodetasks.Subnet whose normalized name matches the subnet the InstanceGroup references. If no Subnet task with the expected name (clusterName-subnetName, normalized) exists, the build fails with this error. It indicates a mismatch between the instance group's subnet reference and the subnets created by the network model builder.

Source

Thrown at pkg/model/linodemodel/instances.go:157

		requirePublic = false
	}

	return &requirePublic
}

// findInstanceTask searches for the instance task corresponding to the given instance group name in the provided context.
func findSubnetTask(c *fi.CloudupModelBuilderContext, subnetTaskName string, ig *kops.InstanceGroup) (*linodetasks.Subnet, error) {
	for _, task := range c.Tasks {
		subnet, ok := task.(*linodetasks.Subnet)
		if !ok {
			continue
		}
		if fi.ValueOf(subnet.Name) == subnetTaskName {
			return subnet, nil
		}
	}

	return nil, fmt.Errorf("subnet task %q not found for InstanceGroup %q", subnetTaskName, ig.Name)
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Ensure the subnet name in the InstanceGroup's spec.subnets matches a subnet declared in cluster.spec.networking.subnets exactly.
  2. Run kops get cluster -o yaml and cross-check subnet names.
  3. If Linode label normalization truncates names, shorten the subnet name so the full label fits Linode limits.
  4. Re-run kops update so the network model builder regenerates Subnet tasks before instance tasks.

Example fix

// before: instance group referencing a subnet missing from the cluster spec
ig.Spec.Subnets = ["us-east-1b"]  // cluster only defines "us-east-1a"
// after
ig.Spec.Subnets = ["us-east-1a"]
Defensive patterns

Strategy: validation

Validate before calling

clusterSubnets := map[string]bool{}
for _, s := range cluster.Spec.Networking.Subnets {
    clusterSubnets[s.Name] = true
}
for _, ig := range instanceGroups {
    for _, sn := range ig.Spec.Subnets {
        if !clusterSubnets[sn] {
            return fmt.Errorf("instance group %s references undeclared subnet %q", ig.Name, sn)
        }
    }
}

Prevention

When it happens

Trigger: An InstanceGroup references a subnet name that is not present in cluster.spec.networking.subnets, so NetworkModelBuilder never created a matching Subnet task; or the name normalization differs (e.g. subnet named with characters normalized away causing a different label).

Common situations: Typo in the instance group's subnets list; subnet deleted from cluster spec while instance group still references it; cluster name too long causing normalized label truncation collisions/mismatches; building an instance group against a cluster whose network model build was skipped.

Related errors


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