Skip to content

GCE: enable NAT64 for IPv6-only clusters#18520

Open
shreyaabaranwal wants to merge 1 commit into
kubernetes:masterfrom
shreyaabaranwal:gce-nat64-ipv6
Open

GCE: enable NAT64 for IPv6-only clusters#18520
shreyaabaranwal wants to merge 1 commit into
kubernetes:masterfrom
shreyaabaranwal:gce-nat64-ipv6

Conversation

@shreyaabaranwal

Copy link
Copy Markdown

What this does

GCE pods on an IPv6-only cluster currently have no way to reach
IPv4-only destinations — there's just no NAT64 path for them. AWS
already solved this with a 64:ff9b::/96 route (see
pkg/model/awsmodel/network.go), so this PR brings GCE up to speed by
enabling NAT64 on the Cloud NAT router whenever the cluster is
IPv6-only (spec.IsIPv6Only()).

Scope

Good news: this turned out smaller than I expected, because GCE's
Cloud NAT already has built-in NAT64 support — it was just never
wired up in kOps.

Per the discussion on #17840, this PR sticks to the part apeabody
flagged as the priority: pod/service networking goes IPv6-only,
while the VMs and subnets stay comfortably dual-stack
(stackType=IPV4_IPV6) for now. Making the VMs/subnets themselves
IPv6-only is a bigger lift and is left for a follow-up PR.

Changes

  • upup/pkg/fi/cloudup/gcetasks/router.go — adds a
    SourceSubnetworkIPRangesToNAT64 field to the Router task, wired
    through Find, RenderGCE, and RenderTerraform. (Also added a
    small nil-guard here so non-IPv6 clusters don't end up with a
    permanent phantom diff on every kops update cluster — found that
    one the hard way during testing.)
  • pkg/model/gcemodel/network.go — sets NAT64 to
    ALL_IPV6_SUBNETWORKS on the Cloud NAT router when
    b.IsIPv6Only() is true. Five lines, does its job.
  • pkg/model/gcemodel/network_test.go — new table-driven test
    covering both the IPv6-only and non-IPv6-only paths, since there
    wasn't an existing unit test file for network.go to extend.

Testing

  • go build ./upup/pkg/fi/cloudup/gcetasks/... ./pkg/model/gcemodel/...
  • go test ./upup/pkg/fi/cloudup/gcetasks/... ./pkg/model/gcemodel/...

This is my first contribution to kOps, so very open to feedback on
approach, naming, or anything I might've missed!

/kind feature
Part of #17840

On GCE, IPv6-only clusters use dual-stack (IPV4_IPV6) subnets because
GCE does not support IPV6_ONLY subnets yet; pods are still IPv6-only.
Without NAT64 those pods cannot reach IPv4-only destinations.

Set SourceSubnetworkIpRangesToNat64 = ALL_IPV6_SUBNETWORKS on the
CloudNAT router whenever IsIPv6Only() is true. GCE then translates
outbound IPv6 packets addressed to the NAT64 well-known prefix
(64:ff9b::/96) into IPv4, mirroring the explicit 64:ff9b::/96 route
that AWS adds to private route tables for IPv6-only clusters.

Add a unit test that builds the NetworkModelBuilder for both an
IPv6-only cluster (NonMasqueradeCIDR = fd00::/56) and a normal cluster
(NonMasqueradeCIDR = 100.64.0.0/10), and asserts the Router task carries
the expected SourceSubnetworkIPRangesToNAT64 value in each case.

Signed-off-by: shreyaabaranwal <shreyabaranwal229@gmail.com>
@kubernetes-prow kubernetes-prow Bot added the kind/feature Categorizes issue or PR as related to a new feature. label Jun 30, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Welcome @shreyaabaranwal!

It looks like this is your first PR to kubernetes/kops 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/kops has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @shreyaabaranwal. Thanks for your PR.

I'm waiting for a kubernetes 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 size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 30, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign rifelpet 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 hakman June 30, 2026 07:47
@kubernetes-prow kubernetes-prow Bot added the area/provider/gcp Issues or PRs related to gcp provider label Jun 30, 2026
@kubernetes-prow kubernetes-prow Bot requested a review from zetaab June 30, 2026 07:47
@kubernetes-prow kubernetes-prow Bot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 30, 2026
@shreyaabaranwal

Copy link
Copy Markdown
Author

Opened a first PR for this: #18520

Scope: enables NAT64 on the GCE Cloud NAT router when the cluster
is IPv6-only, so pods can reach IPv4-only destinations — VMs and
subnets stay dual-stack as you suggested. Happy to adjust based
on review!

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

Labels

area/provider/gcp Issues or PRs related to gcp provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. needs-ok-to-test Indicates a PR that requires an org member to verify it 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.

1 participant