{"record":{"id":"f2457335682b2297","repo":"kubernetes/kops","slug":"error-finding-aws-dnsname-v","errorCode":null,"errorMessage":"error finding aws DNSName: %v","messagePattern":"error finding aws DNSName: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awsup/aws_cloud.go","lineNumber":1942,"sourceCode":"\t\t\t\t\tZone: aws.ToString(subnet.AvailabilityZone),\n\t\t\t\t}\n\n\t\t\t\tvpcInfo.Subnets = append(vpcInfo.Subnets, subnetInfo)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn vpcInfo, nil\n}\n\nfunc (c *awsCloudImplementation) GetApiIngressStatus(cluster *kops.Cluster) ([]fi.ApiIngressStatus, error) {\n\treturn getApiIngressStatus(c, cluster)\n}\n\nfunc getApiIngressStatus(c AWSCloud, cluster *kops.Cluster) ([]fi.ApiIngressStatus, error) {\n\tvar ingresses []fi.ApiIngressStatus\n\tif lbDnsName, err := findDNSName(c, cluster); err != nil {\n\t\treturn nil, fmt.Errorf(\"error finding aws DNSName: %v\", err)\n\t} else if lbDnsName != \"\" {\n\t\tingresses = append(ingresses, fi.ApiIngressStatus{Hostname: lbDnsName})\n\t}\n\n\treturn ingresses, nil\n}\n\nfunc findDNSName(cloud AWSCloud, cluster *kops.Cluster) (string, error) {\n\tctx := context.TODO()\n\n\tname := \"api.\" + cluster.Name\n\tif cluster.Spec.API.LoadBalancer == nil {\n\t\treturn \"\", nil\n\t}\n\tif cluster.Spec.API.LoadBalancer.Class == kops.LoadBalancerClassNetwork {\n\t\tallLoadBalancers, err := ListELBV2LoadBalancers(ctx, cloud)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"looking for AWS NLB: %w\", err)","sourceCodeStart":1924,"sourceCodeEnd":1960,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awsup/aws_cloud.go#L1924-L1960","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Check IAM permissions of the credentials kOps uses (elasticloadbalancing:DescribeLoadBalancers, elasticloadbalancing:DescribeLoadBalancersV2 equivalents).","Confirm the region/region flag matches where the cluster was provisioned.","If the LB is genuinely gone, recreate it via 'kops update cluster --yes' or set spec.api.loadBalancer appropriately and re-run update.","If the wrapped error is transient (throttling/timeout), retry the operation."],"exampleFix":"// before: vague wrapping lost none but callers can't tell not-found vs auth\nreturn nil, fmt.Errorf(\"error finding aws DNSName: %v\", err)\n// after: (debugging aid) log the wrapped cause chain clearly\nreturn nil, fmt.Errorf(\"error finding aws DNSName: %w\", err)","handlingStrategy":"try-catch","validationCode":"// before relying on ingress status, confirm the LB exists and is reachable\naws elbv2 describe-load-balancers --region <region> \\\n  --query 'LoadBalancers[?starts_with(LoadBalancerName, `api-<cluster>`)].DNSName'","typeGuard":null,"tryCatchPattern":"ingress, err := getApiIngressStatus(cloud, cluster)\nif err != nil {\n    if strings.Contains(err.Error(), \"error finding aws DNSName\") {\n        klog.Warningf(\"API LB DNS not resolvable yet, will retry: %v\", err)\n    } else {\n        return err\n    }\n}","preventionTips":["Do not delete the kops-managed load balancer outside of kops.","Ensure the kops IAM policy includes elasticloadbalancing describe permissions.","Always pass the correct --region when operating on the cluster.","Re-run 'kops update cluster' after any out-of-band AWS console changes."],"tags":["aws","load-balancer","dns","kops"],"backgroundTag":"load-balancer-not-found","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}