[Feature] Add IPv6 support #5215
I think Ray should be able to resolve it and do not need us to pass the node-ip-address explicitly?
Could you please explain why we need extra script for collecting IPv6 test logs?
cc @yjaw @justinyeh1995 to review together if you are interested
Good catch. I verified on an IPv6-only kind cluster with ray 2.58.0: without --node-ip-address, both head and worker auto-detect their pod IPv6 and cross-node tasks work, so I'll drop the default injection and keep KUBERAY_POD_IP only for selecting the dashboard-host family.
The inline collection only grabs the operator log, but the IPv6 failures were cluster-network level (CoreDNS/kube-proxy), which only kind export logs captures.
Can we preserve the existing IPv4 test as well? A table test over IPv4/IPv6 would work.
Is the broader validation intentional? If so, could we expose the verification error instead of reporting every failure as a missing IP SAN?
Done in 98e3484. The test is now a table over IPv4 (10.244.0.5/6) and IPv6 (2001:db8::5/6).
The intent was semantic IP comparison: openssl x509 -text prints IPv6 SANs uppercase and uncompressed, so the previous grep could never match an IPv6 POD_IP. -verify_ip compares the addresses properly. The chain check against the mounted ca.crt is an extra guard, since a cert that doesn't chain to that CA would fail Ray's mTLS handshake anyway.
Semantic-wise I'd think this belongs to generateRayStartCommand or at least we should log the final command like L1492 does. My reason is that user would read the log but see an incomplete rayStartCmd if the user set ray.io/overwrite-container-cmd.
I'd like to discuss prefixing the value of KUBERAY_GEN_RAY_START_CMD with eval. Since it applies to both IPv4 and IPv6 clusters, it would break several existing usages. For example, exec ${KUBERAY_GEN_RAY_START_CMD} in GoogleCloudPlatform/kubernetes-engine-samples fails with exec: eval: not found, and exec bash -lc "${KUBERAY_GEN_RAY_START_CMD}" in Azure/taugrid/managed-workflow-rayjob-cpu.yaml.tmpl fails with syntax error near unexpected token 'then'.
export X='eval if true; then echo yes; fi'
# exec ${KUBERAY_GEN_RAY_START_CMD}
bash -c 'exec ${X}'
# exec bash -lc "${KUBERAY_GEN_RAY_START_CMD}"
bash -c 'exec bash -lc "${X}"'
<img width="504" height="109" alt="Image" src="https://github.com/user-attachments/assets/362ea811-e6c1-4500-9f76-9ee6112172c1" />
Since eval is now only needed for the dashboard-host binding snippet, is there an alternative way to determine the IP family? Could the operator write :: / 0.0.0.0 directly from the head Service's spec.ipFamilies so the env var stays a plain command?
Thanks for the explanation and the fix.
Agreed, and thanks for the examples. In fd81d10 the controller now reads the head Service's spec.ipFamilies and writes :: or 0.0.0.0 into dashboard-host directly.
I think we do not need this helper function. We can reuse testServices from setupTest(t). setupTest already builds the head Service into testServices.
runtimeObjects := append(testServices, testPods[0:1]...)
ditto
ditto
ditto
ditto
Done
Could you share the specific IPv6 failures you encountered? Logs or a CI run link would be helpful. This script also collects several types of diagnostics beyond kind export logs. Could you also clarify how they are relate to the failures? Thanks.
Head pod creation races the service cache
Medium Severity
<!-- DESCRIPTION START -->createHeadPod now lists the head Service to decide dashboard-host before the Pod can be built. That list reads the informer cache, but reconcileHeadService just wrote the Service through the API server in the same loop. On first create the cache can still be empty, so getHeadServiceIPFamily errors and head Pod creation is skipped until a later reconcile. Previously the head Pod did not depend on that list.
<!-- DESCRIPTION END -->
<!-- BUGBOT_BUG_ID: 74fdd368-e158-4477-8a53-861706cb19c8 -->
<!-- LOCATIONS START
ray-operator/controllers/ray/raycluster_controller.go#L1632-L1642
ray-operator/controllers/ray/raycluster_controller.go#L2148-L2158
LOCATIONS END -->
<details>
<summary>Additional Locations (1)</summary>
ray-operator/controllers/ray/raycluster_controller.go#L2148-L2158</details>
<div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjIwMGNjNjRkLWI2NjEtNDVmOC1iZDNiLTE1ZGFjMzE4ODNhMCIsImVuY3J5cHRpb25LZXkiOiJtRjk3NTZmcVRsRm85NG9GMFpEVjl1cTRjSlNSVjJMWGRlc2x1S3JXdERNIiwiYnJhbmNoIjoiZmVhdHVyZS9pcHY2LXN1cHBvcnQiLCJyZXBvT3duZXIiOiJyYXktcHJvamVjdCIsInJlcG9OYW1lIjoia3ViZXJheSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a> <a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjIwMGNjNjRkLWI2NjEtNDVmOC1iZDNiLTE1ZGFjMzE4ODNhMCIsImVuY3J5cHRpb25LZXkiOiJtRjk3NTZmcVRsRm85NG9GMFpEVjl1cTRjSlNSVjJMWGRlc2x1S3JXdERNIiwiYnJhbmNoIjoiZmVhdHVyZS9pcHY2LXN1cHBvcnQiLCJyZXBvT3duZXIiOiJyYXktcHJvamVjdCIsInJlcG9OYW1lIjoia3ViZXJheSIsInByTnVtYmVyIjo1MjE1LCJjb21taXRTaGEiOiI5Mjg4Y2NhMmEyZjE1NjVlNzVhZjEzM2EzYmExM2RhMGI0M2JmOWUyIiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div>
<sup>Reviewed by Cursor Bugbot for commit 9288cca2a2f1565e75af133a3ba13da0b43bf9e2. Configure here.</sup>
<!-- BUGBOT_REVIEW -->
Cursor Bugbot has reviewed your changes and found 1 potential issue.
<!-- BUGBOT_FIX_ALL -->
<a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9BTExfSU5fQ1VSU09SIiwiZGF0YSI6eyJyZWRpc0tleSI6ImJ1Z2JvdC1tdWx0aTplYjQ2MWUwMy04MzNmLTQ0YzItOWNlYy1hZjI1OWZmZjRjMTciLCJlbmNyeXB0aW9uS2V5IjoiOGt5ZnVtaDhRZGp6UkFNQVZCOUhEVXhRT1dKbXVRTjFiQ0Z6eHN1ZWV0USIsImJyYW5jaCI6ImZlYXR1cmUvaXB2Ni1zdXBwb3J0IiwicmVwb093bmVyIjoicmF5LXByb2plY3QiLCJyZXBvTmFtZSI6Imt1YmVyYXkiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix All in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>
<!-- /BUGBOT_FIX_ALL -->
<sup>Reviewed by Cursor Bugbot for commit 9288cca2a2f1565e75af133a3ba13da0b43bf9e2. Configure here.</sup>
Sure, the failure was Buildkite build. TestRayClusterIPv6 timed out with the worker Pod stuck in Init forever.
kubectl logs --all-containers): the worker’s wait-gcs-ready kept failing to reach raycluster-ipv6-head-svc.<ns>.svc.cluster.local:6379. The operator log looked completely healthy, so without the init container output there was nothing to go on.
kind export logs (CoreDNS): repeated queries for raycluster-ipv6-head-svc.<ns>.svc.cluster.local.us-west-2.compute.internal. failing with dial udp <ipv4>:53: connect: network is unreachable. That was the root cause: the Buildkite host’s search us-west-2.compute.internal leaked into the kind node and every Pod (ndots:5), CoreDNS forwarded the host-suffix query to an IPv4 upstream that is unreachable from an IPv6-only Pod and returned SERVFAIL, and gRPC’s c-ares resolver aborts on SERVFAIL instead of retrying the bare name. Fixed in a949a25c by stripping the search domain from the node right after kind create cluster.
kubectl get pods -o wide and events: confirm the Pods actually got IPv6 addresses and which Pod is stuck in which init container. Cheap, and the first thing you look at.
The same init container logs also surfaced the second IPv6 bug in this PR: the old wait-for-tls-ip-san grep could never match an IPv6 SAN because openssl prints it uppercase and uncompressed.
In an IPv4 kind cluster the forward succeeds (NXDOMAIN), so the other e2e jobs never hit this and the operator-log-only collection was enough for them. Now that the root cause is fixed, I’m fine either way: I can remove this file if you think it’s unnecessary, or make it a shared collector for all e2e jobs in a follow-up.
Thanks for the context. I'm fine keeping it in this PR since it only runs for this pr.
nit: maybe this reads clearer
if hasIPv4 || !hasIPv6 {
Overall LGTM. The pr description looks outdated. Can you also update the pr description to mention the dashboard-host is now derived from the head Service's IP family?
@machichima to do final pass
Just FYI, I have a PR for supporting worker FQDN, after it's merged we do not need the wait-for-tls-ip-san init container, so we may not need this change
Seems like a true issue, did you tested it?
Using localhost will let the pod resolve it through its /etc/hosts. However, I think pods in an IPv6-only cluster also have 127.0.0.1 in that table. Could you please confirm that localhost resolves to the IPv6 address correctly in that case? Or can we directly put ::1 / 127.0.0.1 here based on the IP family?
If the dashboard-host does not matter, can we just use pod := r.buildHeadPod(ctx, instance, "")?
Reproduced it. In a burst of 120 RayClusters, 8 hit the cache miss and 4 briefly showed ReplicaFailure=True. Now the head Service is read from the API server on a cache miss, and 360 clusters over three bursts show no error.
Checked on an IPv6-only cluster. /etc/hosts has both ::1 and 127.0.0.1 for localhost, and the client tries ::1 first then falls back, so it works whether the server binds :: or 0.0.0.0.
As a follow-up, we can run the whole e2e suite on an IPv6-only cluster in CI to make sure every feature works there, and use KUBERAY_TEST_IPV6=true as the switch. The CI can be triggered manually so that it won't block other PRs.
In this PR, can you run manual test for ray job submit with IPv6 to ensure it works?
As a follow-up, we can run the whole e2e suite on an IPv6-only cluster in CI to make sure every feature works there, and use KUBERAY_TEST_IPV6=true as the switch. The CI can be triggered manually so that it won't block other PRs.
> In this PR, can you run manual test for ray job submit with IPv6 to ensure it works?
Sounds good, I'll open a follow-up to run the whole e2e suite on an IPv6-only cluster behind KUBERAY_TEST_IPV6=true with a manual trigger.
For this PR I tested RayJob on an IPv6-only kind cluster (ipFamily: ipv6, kind v0.31.0, Kubernetes v1.35.0) with the operator built from this PR and rayproject/ray:2.58.0, in all three submission modes. The entrypoint runs 10 remote tasks and prints the node addresses. The command output below is trimmed to the relevant columns.
$ kubectl get nodes -o wide
NAME STATUS VERSION INTERNAL-IP
kind-control-plane Ready v1.35.0 fc00:f853:ccd:e793::2
$ kubectl get rayjob -n rayjob-ipv6
NAME MODE JOB STATUS DEPLOYMENT STATUS MESSAGE
ipv6-http HTTPMode SUCCEEDED Complete Job finished successfully.
ipv6-k8sjob K8sJobMode SUCCEEDED Complete Job finished successfully.
ipv6-sidecar SidecarMode SUCCEEDED Complete Job finished successfully.
$ kubectl get pods -n rayjob-ipv6 -o wide
NAME READY STATUS IP
ipv6-http-m5w8c-head-jvl9w 1/1 Running fd00:10:244::21
ipv6-http-m5w8c-small-group-worker-jrf2x 1/1 Running fd00:10:244::22
ipv6-k8sjob-k4gdt 0/1 Completed fd00:10:244::25
ipv6-k8sjob-lfjc9-head-lpchv 1/1 Running fd00:10:244::1f
ipv6-k8sjob-lfjc9-small-group-worker-z4zg9 1/1 Running fd00:10:244::20
ipv6-sidecar-p8qjh-head-zbkmb 1/2 NotReady fd00:10:244::23
ipv6-sidecar-p8qjh-small-group-worker-lhk87 1/1 Running fd00:10:244::24
All head Pods were started with --dashboard-host=:: and every head Service has ipFamilies: [IPv6]. The sidecar head Pod shows 1/2 NotReady only because its submitter container has already completed.
<details>
<summary>K8sJobMode, <code>kubectl logs job/ipv6-k8sjob</code> (submits through the head Service)</summary>
2026-11-13 17:29:34,876 INFO cli.py:42 -- Job submission server address: http://ipv6-k8sjob-lfjc9-head-svc.rayjob-ipv6.svc.cluster.local:8265
2026-11-13 17:29:35,329 SUCC cli.py:66 -- ----------------------------------------------
2026-11-13 17:29:35,329 SUCC cli.py:67 -- Job 'ipv6-k8sjob-6rmjg' submitted successfully
2026-11-13 17:29:35,329 SUCC cli.py:68 -- ----------------------------------------------
2026-11-13 17:29:35,329 INFO cli.py:330 -- Next steps
2026-11-13 17:29:35,329 INFO cli.py:331 -- Query the logs of the job:
2026-11-13 17:29:35,329 INFO cli.py:333 -- ray job logs ipv6-k8sjob-6rmjg
2026-11-13 17:29:35,329 INFO cli.py:335 -- Query the status of the job:
2026-11-13 17:29:35,329 INFO cli.py:337 -- ray job status ipv6-k8sjob-6rmjg
2026-11-13 17:29:35,329 INFO cli.py:339 -- Request the job to be stopped:
2026-11-13 17:29:35,329 INFO cli.py:341 -- ray job stop ipv6-k8sjob-6rmjg
2026-11-13 17:29:38,892 INFO cli.py:42 -- Job submission server address: http://ipv6-k8sjob-lfjc9-head-svc.rayjob-ipv6.svc.cluster.local:8265
2026-11-13 17:29:35,117 INFO job_manager.py:583 -- Runtime env is setting up.
Running entrypoint for job ipv6-k8sjob-6rmjg: python /home/ray/samples/job.py
2026-11-13 17:29:36,162 INFO worker.py:1683 -- Using address [fd00:10:244::1f]:6379 set in the environment variable RAY_ADDRESS
2026-11-13 17:29:36,164 INFO worker.py:1833 -- Connecting to existing Ray cluster at address: [fd00:10:244::1f]:6379...
2026-11-13 17:29:36,175 INFO worker.py:2015 -- Connected to Ray cluster. View the dashboard at http://[fd00:10:244::1f]:8265
result 285
nodes ['fd00:10:244::1f', 'fd00:10:244::20']
2026-11-13 17:29:43,911 INFO sdk.py:520 -- WebSocket closed for job ipv6-k8sjob-6rmjg with close code 1000
2026-11-13 17:29:43,917 SUCC cli.py:66 -- ---------------------------------
2026-11-13 17:29:43,917 SUCC cli.py:67 -- Job 'ipv6-k8sjob-6rmjg' succeeded
2026-11-13 17:29:43,917 SUCC cli.py:68 -- ---------------------------------
</details>
<details>
<summary>SidecarMode, <code>kubectl logs <head pod> -c ray-job-submitter</code> (submits through <code>http://localhost:8265</code>)</summary>
Waiting for Ray Dashboard GCS to become healthy at http://localhost:8265 ...
Waiting for Ray Dashboard GCS to become healthy at http://localhost:8265 ...
Waiting for Ray Dashboard GCS to become healthy at http://localhost:8265 ...
Waiting for Ray Dashboard GCS to become healthy at http://localhost:8265 ...
2026-11-13 17:29:19,770 INFO cli.py:42 -- Job submission server address: http://localhost:8265
2026-11-13 17:29:20,274 SUCC cli.py:66 -- -----------------------------------------------
2026-11-13 17:29:20,274 SUCC cli.py:67 -- Job 'ipv6-sidecar-4xbrg' submitted successfully
2026-11-13 17:29:20,274 SUCC cli.py:68 -- -----------------------------------------------
2026-11-13 17:29:20,274 INFO cli.py:330 -- Next steps
2026-11-13 17:29:20,274 INFO cli.py:331 -- Query the logs of the job:
2026-11-13 17:29:20,274 INFO cli.py:333 -- ray job logs ipv6-sidecar-4xbrg
2026-11-13 17:29:20,274 INFO cli.py:335 -- Query the status of the job:
2026-11-13 17:29:20,274 INFO cli.py:337 -- ray job status ipv6-sidecar-4xbrg
2026-11-13 17:29:20,274 INFO cli.py:339 -- Request the job to be stopped:
2026-11-13 17:29:20,274 INFO cli.py:341 -- ray job stop ipv6-sidecar-4xbrg
2026-11-13 17:29:21,370 INFO cli.py:42 -- Job submission server address: http://localhost:8265
2026-11-13 17:29:20,043 INFO job_manager.py:583 -- Runtime env is setting up.
Running entrypoint for job ipv6-sidecar-4xbrg: bash -c 'sleep 60 && python /home/ray/samples/job.py'
2026-11-13 17:30:26,010 INFO worker.py:1683 -- Using address [fd00:10:244::23]:6379 set in the environment variable RAY_ADDRESS
2026-11-13 17:30:26,012 INFO worker.py:1833 -- Connecting to existing Ray cluster at address: [fd00:10:244::23]:6379...
2026-11-13 17:30:26,023 INFO worker.py:2015 -- Connected to Ray cluster. View the dashboard at http://[fd00:10:244::23]:8265
result 285
nodes ['fd00:10:244::23', 'fd00:10:244::24']
2026-11-13 17:30:30,371 INFO sdk.py:520 -- WebSocket closed for job ipv6-sidecar-4xbrg with close code 1000
2026-11-13 17:30:30,374 SUCC cli.py:66 -- ----------------------------------
2026-11-13 17:30:30,374 SUCC cli.py:67 -- Job 'ipv6-sidecar-4xbrg' succeeded
2026-11-13 17:30:30,374 SUCC cli.py:68 -- ----------------------------------
</details>
<details>
<summary>HTTPMode, <code>ray job logs ipv6-http-4p7mk</code> from the head Pod (the operator submits through the dashboard HTTP API, there is no submitter)</summary>
2026-11-13 17:30:42,890 INFO cli.py:42 -- Job submission server address: http://[fd00:10:244::21]:8265
2026-11-13 17:30:42,898 INFO cli.py:569 -- 2026-11-13 17:29:28,690 INFO job_manager.py:583 -- Runtime env is setting up.
Running entrypoint for job ipv6-http-4p7mk: python /home/ray/samples/job.py
2026-11-13 17:29:29,743 INFO worker.py:1683 -- Using address [fd00:10:244::21]:6379 set in the environment variable RAY_ADDRESS
2026-11-13 17:29:29,745 INFO worker.py:1833 -- Connecting to existing Ray cluster at address: [fd00:10:244::21]:6379...
2026-11-13 17:29:29,755 INFO worker.py:2015 -- Connected to Ray cluster. View the dashboard at http://[fd00:10:244::21]:8265
result 285
nodes ['fd00:10:244::21', 'fd00:10:244::22']
</details>
The SidecarMode entrypoint has a sleep 60 in front. A SidecarMode job that finishes within a few seconds can leave the RayJob stuck in Initializing, because the submitter exits before the RayCluster is first Ready.
justinyeh1995
400Ping
Why are these changes needed?
This PR adds IPv6-only support to KubeRay.
In an IPv6-only Kubernetes cluster, KubeRay hard-coded
--dashboard-host=0.0.0.0, so theRay dashboard only bound IPv4 and RayService/RayJob could not reach it. Several places also
formatted
host:portwithfmt.Sprintf, which produces invalid URLs for IPv6 addresses, andthe auto-generated mTLS certificates only covered the IPv4 loopback.
This change:
dashboard-hostdefault from the head Service's IP family: the controllerreads
spec.ipFamilies(falling back to the family ofclusterIP, then IPv4) and writes::or0.0.0.0into the generatedray startcommand. No shell logic runs inside thePod, and
KUBERAY_GEN_RAY_START_CMDstays a plain command. Users can still overridedashboard-hostinrayStartParams.localhostinstead of127.0.0.1for in-Pod addresses (RAY_ADDRESSon the head,sidecar
ray job submit) so they resolve in either family, and usesnet.JoinHostPortwhen building URLs from Pod IPs.
::1for IPv6,127.0.0.1forIPv4) and switches the
wait-for-tls-ip-saninit container from a textualgreptoopenssl verify -verify_ip, so IPv6 SANs match regardless of case or zero compression.The openssl error is printed on each retry.
ipFamily: ipv6, Ray 2.58.0) coveringTestRayClusterIPv6,TestRayClusterTLSIPv6, andTestRayServiceIPv6. The job stripsthe Buildkite host's DNS
searchdomain from the kind node, because withndots:5itleaks into Pods and makes CoreDNS return SERVFAIL for the head Service name in an
IPv6-only cluster. On failure the job also collects init container logs, events, and
kind export logs.docs/guidance/rayStartParams.md.Scope and notes:
--node-ip-address.http_options.host: "::"inserveConfigV2.Related issue number
Related to ray-project/ray#54660.
Labels
release time, I have added the
doc-updates-requiredlabel.breaking-changelabel.
Checks
- [x] Unit tests
- [x] Manual tests
- [ ] This PR is not tested :(