kubernetes/kops · error

error querying for NLB listeners :%v

Error message

error querying for NLB listeners :%v

What it means

NetworkLoadBalancerListener.Find pages through ELBV2 DescribeListeners for the NLB and wraps any pagination error with this message. It means kOps could not enumerate the NLB's listeners, so it cannot compute the task's actual state.

Source

Thrown at upup/pkg/fi/cloudup/awstasks/networkloadbalancerlistener.go:82

	}

	loadBalancerArn := e.NetworkLoadBalancer.loadBalancerArn
	if loadBalancerArn == "" {
		return nil, nil
	}

	var l *elbv2types.Listener
	{
		request := &elbv2.DescribeListenersInput{
			LoadBalancerArn: &loadBalancerArn,
		}
		// TODO: Move to lbInfo?
		var allListeners []elbv2types.Listener
		paginator := elbv2.NewDescribeListenersPaginator(cloud.ELBV2(), request)
		for paginator.HasMorePages() {
			page, err := paginator.NextPage(ctx)
			if err != nil {
				return nil, fmt.Errorf("error querying for NLB listeners :%v", err)
			}
			allListeners = append(allListeners, page.Listeners...)
		}

		var matches []elbv2types.Listener
		for _, listener := range allListeners {
			if aws.ToInt32(listener.Port) == int32(e.Port) {
				matches = append(matches, listener)
			}
		}
		if len(matches) == 0 {
			return nil, nil
		}
		if len(matches) > 1 {
			return nil, fmt.Errorf("found multiple listeners matching %+v", e)
		}
		l = &matches[0]
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the wrapped AWS error: LoadBalancerNotFound implies the NLB is gone — refresh or recreate it first
  2. Verify IAM permissions for elasticloadbalancing:DescribeListeners
  3. Retry on throttling (AWS error code ThrottlingException) with backoff
  4. Confirm the load balancer ARN stored on the task is current
Defensive patterns

Strategy: retry

Validate before calling

// confirm the NLB exists before describing listeners
_, err := cloud.ELBV2().DescribeLoadBalancers(&elbv2.DescribeLoadBalancersInput{LoadBalancerArns: []string{lbArn}})
if err != nil { return nil, fmt.Errorf("NLB %s not found: %w", lbArn, err) }

Try / catch

page, err := paginator.NextPage(ctx)
if err != nil {
  if isThrottling(err) { /* backoff and retry page */ }
  return nil, fmt.Errorf("error querying for NLB listeners :%v", err)
}

Prevention

When it happens

Trigger: DescribeListenersPaginator.NextPage fails due to invalid listener/load balancer ARN, LoadBalancerNotFound, IAM permission missing on elasticloadbalancing:DescribeListeners, throttling, or network errors.

Common situations: NLB deleted out-of-band while its listeners task still exists; IAM role stripped of describe permissions; AWS API throttling on clusters with many listeners.

Related errors


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