kubernetes/kops · error

Found NLB %q linked to DNS name %q, but it did not have a Na

Error message

Found NLB %q linked to DNS name %q, but it did not have a Name tag

What it means

After finding the NLB matching the Route53 alias, findDNSTargetNLB reads its ELBV2 tags and requires a 'Name' tag to map the load balancer back to a kops task (dnsname.go:156). If the NLB has no Name tag, kops returns this error because it cannot correlate the NLB with the cluster's load balancer task.

Source

Thrown at upup/pkg/fi/cloudup/awstasks/dnsname.go:156

	return nil, nil
}

func findDNSTargetNLB(cloud awsup.AWSCloud, aliasTarget *route53types.AliasTarget, dnsName string, targetDNSName *string) (DNSTarget, error) {
	lb, err := findNetworkLoadBalancerByAlias(cloud, aliasTarget)
	if err != nil {
		return nil, fmt.Errorf("error mapping DNSName %q to LoadBalancer: %v", dnsName, err)
	}
	if lb != nil {
		loadBalancerName := aws.ToString(lb.LoadBalancerName) // TODO: can we keep these on object
		loadBalancerArn := aws.ToString(lb.LoadBalancerArn)   // TODO: can we keep these on object
		tagMap, err := cloud.DescribeELBV2Tags([]string{loadBalancerArn})
		if err != nil {
			return nil, err
		}
		tags := tagMap[loadBalancerArn]
		nameTag, _ := awsup.FindELBV2Tag(tags, "Name")
		if nameTag == "" {
			return nil, fmt.Errorf("Found NLB %q linked to DNS name %q, but it did not have a Name tag", loadBalancerName, fi.ValueOf(targetDNSName))
		}
		return &NetworkLoadBalancer{Name: new(nameTag)}, nil
	}
	return nil, nil
}

func (e *DNSName) Run(c *fi.CloudupContext) error {
	return fi.CloudupDefaultDeltaRunMethod(e, c)
}

func (s *DNSName) CheckChanges(a, e, changes *DNSName) error {
	if a == nil {
		if fi.ValueOf(e.Name) == "" {
			return fi.RequiredField("Name")
		}
		if fi.ValueOf(e.ResourceName) == "" {
			return fi.RequiredField("ResourceName")
		}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Add a 'Name' tag to the NLB matching the kops load balancer name (aws elbv2 add-tags or EC2 console -> Load Balancers -> Tags)
  2. Identify the intended NLB via the loadBalancerName in the error and confirm it belongs to this cluster before tagging
  3. If the NLB is stale/foreign, delete it or fix the Route53 alias so it no longer matches
  4. Re-run kops update cluster after tagging

Example fix

// before: untagged NLB found via alias
aws elbv2 describe-tags --resource-arns arn:aws:elasticloadbalancing:...:loadbalancer/net/xxx
// after
aws elbv2 add-tags --resource-arns arn:aws:elasticloadbalancing:...:loadbalancer/net/xxx --tags Key=Name,Value=api.cluster.example.com
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check: every alias-eligible NLB must carry a Name tag
func nlbHasNameTag(arn string, tags []elbv2types.Tag) error {
	for _, t := range tags {
		if aws.ToString(t.Key) == "Name" && aws.ToString(t.Value) != "" {
			return nil
		}
	}
	return fmt.Errorf("NLB %s missing required 'Name' tag", arn)
}

Try / catch

target, err := findDNSTarget(cloud, aliasTarget, dnsName, resourceName)
if err != nil && strings.Contains(err.Error(), "did not have a Name tag") {
	// extract the NLB name from the message, add the Name tag, then re-run kops update
	return fmt.Errorf("tag the NLB with Key=Name and retry: %w", err)
}

Prevention

When it happens

Trigger: An NLB exists whose DNS alias matches the Route53 record, but DescribeELBV2Tags shows no 'Name' tag — typically because the tag was removed manually, the NLB came from another tool (terraform/cloudformation) without a Name tag, or a rebuilt cluster reuses the DNS name of an old untagged NLB.

Common situations: Compliance/cleanup tooling strips AWS tags; a new cluster created with the same DNS name finds an old untagged NLB; an NLB created outside kops aliased into the cluster's zone; a partial apply where tagging failed earlier.

Related errors


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