Skip to content

fix(networkpolicy): allow DNS egress to link-local resolvers (GKE Cloud DNS, NodeLocal DNSCache) - #4001

Open
aqeelat wants to merge 1 commit into
tektoncd:mainfrom
aqeelat:fix/dns-egress-link-local
Open

fix(networkpolicy): allow DNS egress to link-local resolvers (GKE Cloud DNS, NodeLocal DNSCache)#4001
aqeelat wants to merge 1 commit into
tektoncd:mainfrom
aqeelat:fix/dns-egress-link-local

Conversation

@aqeelat

@aqeelat aqeelat commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Changes

DNSEgressRule allowed DNS egress only to the kube-dns/CoreDNS pod peer. On GKE clusters using Cloud DNS, kubelet points every pod's resolv.conf at the link-local metadata server 169.254.169.254, which no pod selector can match — so on Dataplane V2 clusters DNS egress is dropped and e.g. tekton-results-retention-policy-agent crashloops. NodeLocal DNSCache (169.254.20.10) has the same host-network property.

Adds ipBlock peers 169.254.169.254/32 and 169.254.20.10/32 (UDP+TCP 53) to the Kubernetes-platform DNS rule, alongside the existing pod peer. Purely additive — on clusters not using these resolvers the peers never match. OpenShift unchanged. Fixes #4000.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Release Notes

NetworkPolicies generated by the operator now allow DNS egress to link-local resolvers (GKE Cloud DNS 169.254.169.254 and NodeLocal DNSCache 169.254.20.10), fixing DNS failures on GKE clusters using Cloud DNS.

AI assistance: developed with opencode (GLM model) under my direction; every commit carries an Assisted-by: trailer per the AI contribution policy. I drove scoping and decisions, reviewed every change, and verified each push — unit tests and make test lint for the touched packages.

@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Aug 30, 2026
@tekton-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign pramodbindal after the PR has been reviewed.
You can assign the PR to them by writing /assign @pramodbindal in a comment when ready.

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

@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 30, 2026
@codecov

codecov Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 26.46%. Comparing base (3fc9104) to head (4a145dc).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4001      +/-   ##
==========================================
+ Coverage   26.44%   26.46%   +0.01%     
==========================================
  Files         465      465              
  Lines       24992    24997       +5     
==========================================
+ Hits         6610     6615       +5     
  Misses      17661    17661              
  Partials      721      721              
Flag Coverage Δ
unit-tests 26.46% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

DNSEgressRule allowed DNS egress only to the kube-dns/CoreDNS pod
peer. On GKE clusters using Cloud DNS, kubelet points every pod's
resolv.conf at the link-local metadata server 169.254.169.254,
which no pod selector can match, so DNS egress is dropped on
Dataplane V2 clusters. NodeLocal DNSCache (169.254.20.10, GKE
Autopilot default) has the same host-network property.

Add ipBlock peers 169.254.169.254/32 and 169.254.20.10/32 (UDP+TCP
53) to the Kubernetes-platform DNS rule alongside the existing pod
peer. Purely additive: on clusters not using these resolvers the
peers never match. OpenShift unchanged.

Fixes tektoncd#4000

Signed-off-by: Abdullah Alaqeel <abdullah.t.aqeel@gmail.com>
Assisted-by: GLM (via opencode)
@aqeelat
aqeelat force-pushed the fix/dns-egress-link-local branch from 4e35fa0 to 4a145dc Compare September 4, 2026 16:12
return PlatformParams{
DNSResolverNamespace: "kube-system",
DNSResolverPodLabel: map[string]string{"k8s-app": "kube-dns"},
DNSResolverIPBlocks: []string{"169.254.169.254/32", "169.254.20.10/32"},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add comment here
// 169.254.169.254/32: GKE Cloud DNS forwarder (link-local, host-network).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not just GKE. I think aws and azure also have it.

BTW, I saw it in some charts as 169.254.0.0/16
Do we want that?

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

Labels

release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generated NetworkPolicies break DNS on GKE clusters using Cloud DNS (link-local resolver cannot be matched by pod selector)

3 participants