kubernetes/kops · error

error creating NLB %q: %w

Error message

error creating NLB %q: %w

What it means

CreateLoadBalancer failed while creating the NLB — the wrapped AWS error typically indicates a bad subnet/security-group/AllocationId combination, a name conflict, or missing elasticloadbalancing:CreateLoadBalancer permission.

Source

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

			request.Tags = awsup.ELBv2Tags(tags)

			for _, subnetMapping := range e.SubnetMappings {
				request.SubnetMappings = append(request.SubnetMappings, elbv2types.SubnetMapping{
					SubnetId:           subnetMapping.Subnet.ID,
					AllocationId:       subnetMapping.AllocationID,
					PrivateIPv4Address: subnetMapping.PrivateIPv4Address,
				})
			}

			for _, sg := range e.SecurityGroups {
				request.SecurityGroups = append(request.SecurityGroups, aws.ToString(sg.ID))
			}

			klog.V(2).Infof("Creating NLB %q", loadBalancerName)

			response, err := t.Cloud.ELBV2().CreateLoadBalancer(ctx, request)
			if err != nil {
				return fmt.Errorf("error creating NLB %q: %w", loadBalancerName, err)
			}
			if len(response.LoadBalancers) != 1 {
				return fmt.Errorf("error creating NLB %q: found %d", loadBalancerName, len(response.LoadBalancers))
			}

			lb := response.LoadBalancers[0]
			e.DNSName = lb.DNSName
			e.HostedZoneId = lb.CanonicalHostedZoneId
			e.VPC = &VPC{ID: lb.VpcId}
			loadBalancerArn = aws.ToString(lb.LoadBalancerArn)
			e.loadBalancerArn = loadBalancerArn
			e.revision = revision
		}

		if e.waitForLoadBalancerReady {
			klog.Infof("Waiting for load balancer %q to be created...", loadBalancerName)
			request := &elbv2.DescribeLoadBalancersInput{
				Names: []string{loadBalancerName},

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Read the wrapped AWS error: fix subnet ids, security groups, or the ElasticIP allocation
  2. Check IAM permissions for ELBV2 creation
  3. Delete a leftover NLB of the same name if it conflicts
Defensive patterns

Strategy: try-catch

When it happens

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