kubernetes/kops · error

network load balancers do not support detaching subnets

Error message

network load balancers do not support detaching subnets

What it means

The existing NLB is attached to a subnet that is absent from the expected SubnetMappings; AWS NLBs do not support detaching subnets in place, so kOps rejects the change instead of leaving a divergent state.

Source

Thrown at upup/pkg/fi/cloudup/awstasks/network_load_balancer.go:460

				}
				if s.AllocationID != nil {
					expectedSubnets[subnetID] = s.AllocationID
				} else if s.PrivateIPv4Address != nil {
					expectedSubnets[subnetID] = s.PrivateIPv4Address
				} else {
					expectedSubnets[subnetID] = nil
				}
			}

			for _, s := range a.SubnetMappings {
				subnetID := fi.ValueOf(s.Subnet.ID)
				if subnetID == "" {
					return fmt.Errorf("Subnet ID is required for subnet name=%v", fi.ValueOf(s.Subnet.Name))
				}

				eIP, ok := expectedSubnets[subnetID]
				if !ok {
					return fmt.Errorf("network load balancers do not support detaching subnets")
				}
				if fi.ValueOf(eIP) != fi.ValueOf(s.PrivateIPv4Address) || fi.ValueOf(eIP) != fi.ValueOf(s.AllocationID) {
					return fmt.Errorf("network load balancers do not support modifying address settings")
				}
			}
		}
	}
	return nil
}

func (_ *NetworkLoadBalancer) RenderAWS(t *awsup.AWSAPITarget, a, e, changes *NetworkLoadBalancer) error {
	ctx := context.TODO()

	loadBalancerArn := ""

	revision := e.revision

	tags := maps.Clone(e.Tags)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Re-add the missing subnet to the cluster spec / NLB subnet mappings
  2. Or recreate the NLB (delete and `kops update`) so it is built with only the desired subnets
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/awstasks/network_load_balancer.go:460 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/0d52791753692a28. Report an issue: GitHub.