Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPv6 support #9

Open
clementd64 opened this issue Aug 10, 2023 · 2 comments
Open

IPv6 support #9

clementd64 opened this issue Aug 10, 2023 · 2 comments

Comments

@clementd64
Copy link

When K2D_ADVERTISE_ADDR is set to an IPv6, the server crash

unable to get advertise IP address: invalid IP address: 2001:db8::1

When k2d_net is created with IPv6 enabled, the assigned IPv6 is not show in the Service.

Also he Service's ipFamilies field is ignored, leading to confusing case where IPv6-only is "requested" and an IPv4 is showed.

$ docker inspect k2d_net
[
    {
        "Name": "k2d_net",
        // ...
        "EnableIPv6": true,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "172.17.2.0/24",
                    "Gateway": "172.17.2.1"
                },
                {
                    "Subnet": "fd7d:a40b:9c6::/64",
                    "Gateway": "fd7d:a40b:9c6::1/64"
                }
            ]
        },
        // ...
    }
]
$ kubectl get svc my-nginx-svc -o yaml
apiVersion: v1
kind: Service
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: ...
  creationTimestamp: "2023-08-10T13:12:31Z"
  labels:
    app: nginx
  name: my-nginx-svc
  namespace: default
spec:
  clusterIPs:
  - 172.17.2.2
  ipFamilies:
  - IPv6
  ipFamilyPolicy: PreferDualStack
  ports:
  - port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: nginx
  type: ClusterIP
status:
  loadBalancer: {}

Simply getting the IPAddress and GlobalIPv6Address if not empty and based of the content of ipFamilies can do the trick.

service.Spec.ClusterIPs = []string{container.NetworkSettings.Networks[k2dtypes.K2DNetworkName].IPAddress}

@ncresswell
Copy link
Member

Thanks for the report. We didnt build IPv6 into the Alpha version, but can add this into the Beta... will add to backlog for the Beta.

@olljanat
Copy link

Btw. Docker IPv6 supports is known to be very buggy https://github.com/moby/moby/issues?q=is%3Aissue+is%3Aopen+ipv6 so I would recommend to wait that libnetwork refactoring work is ready https://github.com/moby/moby/pulls?q=is%3Apr+is%3Aopen+libnetwork because really using IPv6 option but of course support for it can be already implemented in here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants