<p>It seems to me that we cannot use IPv6 in Kubernetes service loadBalancerSourceRanges. I simplified the repro to a very simple configuration like below:</p>
<pre><code>kind: Pod
apiVersion: v1
metadata:
  name: apple-app
  labels:
    app: apple
spec:
  containers:
    - name: apple-app
      image: hashicorp/http-echo
      args:
        - &quot;-text=apple&quot;

---

kind: Service
apiVersion: v1
metadata:
  name: apple-service
spec:
  selector:
    app: apple
  type: &quot;LoadBalancer&quot;
  loadBalancerSourceRanges:
  - &quot;2600:1700:aaaa:aaaa::aa/32&quot;
  ports:
    - port: 5678 # Default port for image
</code></pre>
<p>Deploying it on GKE and I got the following failure when I &quot;kubectl describe service apple-service&quot;:</p>
<pre><code>  Warning  KubeProxyIncorrectIPVersion  13m (x11 over 62m)  kube-proxy, gke-xxxx  
  2600:1700:aaaa:aaaa::aa/32 in loadBalancerSourceRanges has incorrect IP version
  Normal   EnsuringLoadBalancer         51s (x18 over 62m)  service-controller                                   
  Ensuring load balancer
  Warning  SyncLoadBalancerFailed       46s (x17 over 62m)  service-controller                                   
  Error syncing load balancer: failed to ensure load balancer: googleapi: Error 400: Invalid 
  value for field 'resource.sourceRanges[1]': '2600:1700::/32'. Must be a valid IPV4 CIDR address range., invalid
</code></pre>
<p>Just want to confirm my conclusion (i.e. that this is not supported in k8s), or, if my conclusion is not correct, what is the fix. Maybe there is a way for the whole cluster to be on IPv6 so that this will work?</p>
<p>Thank you very much!</p>

Wei
<p>You are seeing this error because IPv6 cannot be used along IPv4 in k8s (you could run k8s in ipv6-only mode, but this would not work in GCP since GCP does not allow to use ipv6 addresses for internal communication).</p>
<p><a href="https://cloud.google.com/vpc/docs/vpc" rel="nofollow noreferrer">GCP VPC docs</a>:</p>
<blockquote>
<p><strong>VPC networks only support IPv4 unicast traffic</strong>. They <strong>do not support</strong> broadcast, multicast, or <strong>IPv6</strong> traffic within the network; VMs in the VPC network can only send to IPv4 destinations and only receive traffic from IPv4 sources. However, it is possible to create an IPv6 address for a global load balancer.</p>
</blockquote>
<p>K8s 1.16+ provides dual stack feature that is in early development (alpha) stage that allows for IPv6 and can be enabled with <a href="https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/" rel="nofollow noreferrer">feature-gates</a>, but since you are using GKE, controlplain is managed by GCP so you can't enable it (and since is alpha feature you probably should not want to).</p>
<p>You can find a bit more about this dual stack feature here:
<a href="https://kubernetes.io/docs/concepts/services-networking/dual-stack/" rel="nofollow noreferrer">dual-stack</a>
and here:
<a href="https://kubernetes.io/docs/tasks/network/validate-dual-stack/" rel="nofollow noreferrer">validate-dual-stack</a></p>
<p>Here is the latest pull request I have found on github relating this feature: <a href="https://github.com/kubernetes/kubernetes/pull/91824" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/pull/91824</a></p>
<p>I think that we can expect that the beta version will appear soon in one of k8s releases but since GKE is about two versions behind the latest relese, I infere that it will take some time before we can use IPv6 with GKE.</p>
