kubernetes/kops · error

Subnet.ID is required

Error message

Subnet.ID is required

What it means

linodetasks.Instance.Find reconciles existing Linode instances against the desired state. For each matching instance it requires the task's Subnet (and its API ID) to be set, because interface comparison needs the VPC/subnet identifier. If i.Subnet or i.Subnet.ID is nil, Find aborts with 'Subnet.ID is required' rather than guessing. This is a specification error in the task definition, not a cloud-side problem.

Source

Thrown at upup/pkg/fi/cloudup/linodetasks/instance.go:124

	for _, instance := range instances {
		if instance.Type != i.Type {
			needsUpdate = append(needsUpdate, instance.Label)
			continue
		}
		if instance.Image != i.Image {
			needsUpdate = append(needsUpdate, instance.Label)
			continue
		}
		if instance.Region != i.Region {
			needsUpdate = append(needsUpdate, instance.Label)
			continue
		}
		if !hasAllTags(instance.Tags, expectedTags) {
			needsUpdate = append(needsUpdate, instance.Label)
			continue
		}
		if i.Subnet == nil || i.Subnet.ID == nil {
			return nil, fmt.Errorf("Subnet.ID is required")
		}
		interfaces, err := cloud.Client().ListInterfaces(c.Context(), instance.ID, nil)
		if err != nil {
			return nil, fmt.Errorf("error listing Akamai (Linode) interfaces for instance %q: %w", instance.Label, err)
		}
		if !hasExpectedInterfaces(interfaces, fi.ValueOf(i.Subnet.ID), fi.ValueOf(i.RequirePublicInterface)) {
			needsUpdate = append(needsUpdate, instance.Label)
			continue
		}
	}

	actual := *i
	actual.NeedsUpdate = needsUpdate
	actual.Count = len(instances)

	return &actual, nil
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Ensure the cluster spec defines the subnet and that the Instance task's Subnet field is linked to it before Find runs
  2. Run the full apply so the subnet task executes and its ID is populated, not just the instance task
  3. Check that i.Subnet.ID is set in the lifecycle order (subnet creation precedes instance reconciliation)
  4. Validate the manifest / cluster spec against the linode topology requirements

Example fix

// before
c.Subnet = nil // or unlinked task
// after
c.Subnet = &linodetasks.Subnet{Name: s("cluster-subnet"), ID: fi.PtrTo("existing-subnet-id")}
Defensive patterns

Strategy: validation

Validate before calling

if i.Subnet == nil || i.Subnet.ID == nil {
	return errors.New("linode Instance task requires a Subnet with an ID")
}

Type guard

func subnetReady(i *linodetasks.Instance) bool {
	return i != nil && i.Subnet != nil && i.Subnet.ID != nil
}

Try / catch

instances, err := it.Find(context.Background())
if err != nil {
	if strings.Contains(err.Error(), "Subnet.ID is required") {
		return fmt.Errorf("link the Instance task's Subnet and ensure the subnet task ran: %w", err)
	}
	return err
}

Prevention

When it happens

Trigger: Find() iterates instances and reaches the subnet check on an Instance task whose Subnet field was not linked (nil) or whose Subnet task has no ID (not yet resolved/created). Happens during kOps reconciliation when the network topology was changed or the subnet task failed to populate.

Common situations: Cluster spec missing/renamed subnet reference so the Instance task's Subnet link is nil; subnet task executed out of order or failed silently so its ID was never assigned; hand-edited manifests omitting the subnet binding; partial apply where only Instance tasks ran.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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