kubernetes/kops · error

Subnet.VPC is required

Error message

Subnet.VPC is required

What it means

Subnet.Find() requires the Subnet task to carry a reference to its parent VPC before it can query Linode for the actual subnet. A nil VPC reference means the desired state is incomplete, so it errors immediately.

Source

Thrown at upup/pkg/fi/cloudup/linodetasks/subnet.go:54

	VPC  *VPC
}

var _ fi.CloudupTask = &Subnet{}
var _ fi.CompareWithID = &Subnet{}

func (v *Subnet) CompareWithID() *string {
	if v.ID == nil {
		return nil
	}
	id := strconv.Itoa(fi.ValueOf(v.ID))
	return new(id)
}

func (v *Subnet) Find(c *fi.CloudupContext) (*Subnet, error) {
	cloud := c.T.Cloud.(linode.LinodeCloud)

	if v.VPC == nil {
		return nil, fmt.Errorf("Subnet.VPC is required")
	}
	if v.VPC.ID == nil {
		if v.VPC.Name != nil {
			if _, ok := c.Target.(*fi.CloudupDryRunTarget); ok {
				return nil, nil
			}
			return nil, fi.NewTryAgainLaterError("waiting for VPC ID")
		}
		return nil, fmt.Errorf("Subnet.VPC.ID is required")
	}

	subnets, err := cloud.Client().ListVPCSubnets(c.Context(), fi.ValueOf(v.VPC.ID), nil)
	if err != nil {
		return nil, fmt.Errorf("error listing Akamai (Linode) VPC Subnets: %w", err)
	}

	var foundByName *linodego.VPCSubnet
	var foundByIPv4 *linodego.VPCSubnet

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Ensure each subnet in the cluster spec references the cluster's VPC/network config
  2. Re-generate the cluster spec from a valid template instead of hand-editing
  3. Check that the networkID/VPC is defined in the cluster spec before subnets

Example fix

// before (spec)
subnets: [{name: subnet-1}]  // no vpc linkage
// after
// define network/vpc and reference it so Subnet.VPC is populated
Defensive patterns

Strategy: validation

Validate before calling

if subnet.VPC == nil {
    return errors.New("spec error: subnet must reference a VPC before find/create")
}

Type guard

func vpcLinked(s *Subnet) bool { return s != nil && s.VPC != nil }

Try / catch

sub, err := subnetTask.Find(c)
if err != nil && err.Error() == "Subnet.VPC is required" {
    // repair spec linkage to the VPC and re-run
    return err
}

Prevention

When it happens

Trigger: v.VPC == nil when Find() runs — the cluster spec/subnet task was built without linking the subnet to a VPC.

Common situations: Hand-edited cluster spec missing the VPC linkage, or a provisioning-order bug where the VPC task link was never populated.

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/e2fa84a10d5b9225. Report an issue: GitHub.