kubernetes/kops · error

Network with name %q not found

Error message

Network with name %q not found

What it means

Guard error from Network.RenderGCE when the spec marks the network as shared but Find() located no matching network (a == nil). A shared network is expected to pre-exist and be adopted, so absence of the named network is fatal rather than triggering creation.

Source

Thrown at upup/pkg/fi/cloudup/gcetasks/network.go:145

	case "":
		// Treated as "keep existing", only allowed for shared mode
		if !fi.ValueOf(e.Shared) {
			return fmt.Errorf("must specify mode for (non-shared) Network")
		}

	default:
		return fmt.Errorf("unknown mode %q for Network", e.Mode)
	}

	return nil
}

func (_ *Network) RenderGCE(t *gce.GCEAPITarget, a, e, changes *Network) error {
	shared := fi.ValueOf(e.Shared)
	if shared {
		// Verify the network was found
		if a == nil {
			return fmt.Errorf("Network with name %q not found", fi.ValueOf(e.Name))
		}
	}

	if a == nil {
		klog.V(2).Infof("Creating Network with CIDR: %q", fi.ValueOf(e.CIDR))

		network := &compute.Network{
			Name: *e.Name,
		}

		switch e.Mode {
		case "legacy":
			network.IPv4Range = fi.ValueOf(e.CIDR)

		case "auto":
			network.AutoCreateSubnetworks = true

		case "custom":

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Verify the network name (and project override) in the cluster spec matches the existing GCE network
  2. Create the network in GCE first if it does not exist
  3. Drop the shared flag if kOps should create and manage the network
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/gcetasks/network.go:145 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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