kubernetes/kops · error

error finding aws DNSName: %v

Error message

error finding aws DNSName: %v

What it means

getApiIngressStatus in upup/pkg/fi/cloudup/awsup/aws_cloud.go wraps any failure from findDNSName when kOps tries to report the API load balancer's DNS name as ingress status for the cluster. The message exposes the underlying cause (ELB/ELBv2 lookup error or 'load balancer not found') while adding context that the failing step was resolving the AWS DNS name. It means kOps could not determine the hostname that clients should use to reach the Kubernetes API endpoint.

Source

Thrown at upup/pkg/fi/cloudup/awsup/aws_cloud.go:1942

					Zone: aws.ToString(subnet.AvailabilityZone),
				}

				vpcInfo.Subnets = append(vpcInfo.Subnets, subnetInfo)
			}
		}
	}

	return vpcInfo, nil
}

func (c *awsCloudImplementation) GetApiIngressStatus(cluster *kops.Cluster) ([]fi.ApiIngressStatus, error) {
	return getApiIngressStatus(c, cluster)
}

func getApiIngressStatus(c AWSCloud, cluster *kops.Cluster) ([]fi.ApiIngressStatus, error) {
	var ingresses []fi.ApiIngressStatus
	if lbDnsName, err := findDNSName(c, cluster); err != nil {
		return nil, fmt.Errorf("error finding aws DNSName: %v", err)
	} else if lbDnsName != "" {
		ingresses = append(ingresses, fi.ApiIngressStatus{Hostname: lbDnsName})
	}

	return ingresses, nil
}

func findDNSName(cloud AWSCloud, cluster *kops.Cluster) (string, error) {
	ctx := context.TODO()

	name := "api." + cluster.Name
	if cluster.Spec.API.LoadBalancer == nil {
		return "", nil
	}
	if cluster.Spec.API.LoadBalancer.Class == kops.LoadBalancerClassNetwork {
		allLoadBalancers, err := ListELBV2LoadBalancers(ctx, cloud)
		if err != nil {
			return "", fmt.Errorf("looking for AWS NLB: %w", err)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Verify the API load balancer exists: aws elbv2 describe-load-balancers (NLB) or aws elb describe-load-balancers (classic) in the cluster's region, filtered by the kops cluster name tag.
  2. Check IAM permissions of the credentials kOps uses (elasticloadbalancing:DescribeLoadBalancers, elasticloadbalancing:DescribeLoadBalancersV2 equivalents).
  3. Confirm the region/region flag matches where the cluster was provisioned.
  4. If the LB is genuinely gone, recreate it via 'kops update cluster --yes' or set spec.api.loadBalancer appropriately and re-run update.
  5. If the wrapped error is transient (throttling/timeout), retry the operation.

Example fix

// before: vague wrapping lost none but callers can't tell not-found vs auth
return nil, fmt.Errorf("error finding aws DNSName: %v", err)
// after: (debugging aid) log the wrapped cause chain clearly
return nil, fmt.Errorf("error finding aws DNSName: %w", err)
Defensive patterns

Strategy: try-catch

Validate before calling

// before relying on ingress status, confirm the LB exists and is reachable
aws elbv2 describe-load-balancers --region <region> \
  --query 'LoadBalancers[?starts_with(LoadBalancerName, `api-<cluster>`)].DNSName'

Try / catch

ingress, err := getApiIngressStatus(cloud, cluster)
if err != nil {
    if strings.Contains(err.Error(), "error finding aws DNSName") {
        klog.Warningf("API LB DNS not resolvable yet, will retry: %v", err)
    } else {
        return err
    }
}

Prevention

When it happens

Trigger: kops get cluster / status display calls getApiIngressStatus; findDNSName fails because: the API LoadBalancer class is Network and ListELBV2LoadBalancers returns an API error, or the classic ELB describe call fails, or no load balancer matching the cluster name tag exists.

Common situations: The load balancer was deleted out-of-band in the AWS console; IAM credentials lack elasticloadbalancing:DescribeLoadBalancers permissions; wrong region configured on the cloud provider; cluster provisioning was interrupted before the LB was created.

Related errors


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