Skip to content

Added frontend-nlb-status-only annotation to fix ExternalDNS record creation when using a frontend NLB#4849

Open
dominikhei wants to merge 4 commits into
kubernetes-sigs:mainfrom
dominikhei:frontend-nlb-only
Open

Added frontend-nlb-status-only annotation to fix ExternalDNS record creation when using a frontend NLB#4849
dominikhei wants to merge 4 commits into
kubernetes-sigs:mainfrom
dominikhei:frontend-nlb-only

Conversation

@dominikhei

Copy link
Copy Markdown

Issue

#4805

The original issue was surfaced in external-dns#5661, where it was decided that the fix belongs in the AWS Load Balancer Controller rather than ExternalDNS

Description

When frontend NLB is configured via alb.ingress.kubernetes.io/enable-frontend-nlb: "true", the controller writes both the ALB and NLB hostnames to status.loadBalancer.ingress. When using ExternalDNS on AWS, only a DNS record for the first entry is created, meaning the NLB, which is the actual external-facing endpoint, may not get a DNS record at all.

The existing workaround (external-dns.alpha.kubernetes.io/target) requires a two-step deploy because the NLB hostname isn't known until after provisioning, which makes it impractical for automated workflows.

This PR adds a new boolean annotation:
alb.ingress.kubernetes.io/frontend-nlb-status-only: "true"

When set, only the NLB hostname is written to status.loadBalancer.ingress, so ExternalDNS creates a record for the NLB only. The annotation is opt-in to avoid a breaking change. If the NLB DNS is not yet available, the controller falls back to the ALB hostname to avoid leaving status empty.

Validation:

Manually validated on EKS: ingress with the annotation shows 1 status entry (NLB only) and a control ingress without it shows 2 entries (ALB + NLB).

Checklist

  • Added tests that cover your change (if possible)
  • Added/modified documentation as required (such as the README.md, or the docs directory)
  • Manually tested
  • Made sure the title of the PR is a good description that can go into the release notes

BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯

  • Backfilled missing tests for code in same general area 🎉
  • Refactored something and made the world a better place 🌟

@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 23, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @dominikhei. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubernetes-prow kubernetes-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 23, 2026
@kubernetes-prow
kubernetes-prow Bot requested a review from shuqz July 23, 2026 14:05
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dominikhei
Once this PR has been reviewed and has the lgtm label, please assign wweiwei-li for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow
kubernetes-prow Bot requested a review from wweiwei-li July 23, 2026 14:05
@zac-nixon

Copy link
Copy Markdown
Collaborator

/ok-to-test

@kubernetes-prow kubernetes-prow Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 24, 2026
By default, when a frontend NLB is enabled, both the ALB and NLB hostnames appear in the ingress status. When using [ExternalDNS](https://github.com/kubernetes-sigs/external-dns) on AWS, only a DNS record for the first entry is created (see [external-dns#5661](https://github.com/kubernetes-sigs/external-dns/issues/5661)), which means the NLB does not get a DNS record. Setting this annotation to `"true"` restricts the status to only the NLB hostname, so ExternalDNS creates a DNS record pointing at the NLB.

!!!note
This annotation has no effect if `alb.ingress.kubernetes.io/enable-frontend-nlb` is not set, or if the NLB has not yet been provisioned. In those cases the ALB hostname is written to status as normal.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we just want to block setting any hostname if you have this flag set, until the nlb is provisioned? that way there is no weird host flip / flop when you're provisioning an nlb -> alb stack.

@dominikhei dominikhei Jul 24, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change would be pretty simple from a code perspective. I don't see any downside apart from the fact that if anything is waiting on ingress status to be populated before considering the ingress ready could be blocked for longer. But since the current behavior would populate it with the ALB hostname, they would be unblocking on the wrong address anyway...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants