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

Configure IPv4/IPv6 dual-stack #1985

Open
wuyanfeiwork opened this issue May 30, 2024 · 2 comments
Open

Configure IPv4/IPv6 dual-stack #1985

wuyanfeiwork opened this issue May 30, 2024 · 2 comments

Comments

@wuyanfeiwork
Copy link

I need to configure flannel for dual-stack mode, my Kubernetes has been initialized for dual-stack mode, below is my kubeadm-config.yaml file:

---
apiVersion: kubeadm.k8s.io/v1beta3
kind: ClusterConfiguration
networking:
  podSubnet: 2001:db8:42:0::/56,10.244.0.0/16
  serviceSubnet: 2001:db8:42:1::/112,10.96.0.0/16
imageRepository: "localhost:5000"
kubernetesVersion: "1.25.4"
---
apiVersion: kubeadm.k8s.io/v1beta3
kind: InitConfiguration
localAPIEndpoint:
  advertiseAddress: "2408:4002:116a:0:6c2a:43c9:80c0:6664"
  bindPort: 6443
nodeRegistration:
  kubeletExtraArgs:
    node-ip: 2408:4002:116a:0:6c2a:43c9:80c0:6664,192.168.0.1

I need the communication within the cluster to prioritize using IPv6, so I put the IPv6 address before the IPv4 address.

Below are the network-related configurations for flannel:

  net-conf.json: |
    {
      "EnableIPv6": true,
      "IPv6Network": "2001:db8:42:0::/56",
      "EnableIPv4": true,
      "Network": "10.244.0.0/16",
      "Backend": {
        "Type": "vxlan"
      }
    }

The error message when starting flannel is as follows:

image

I don’t understand why it prompts: Observed a panic: Address is not an IPv4 address.

My server has both IPv4 and IPv6 addresses:

image

I changed EnableIPv4 to false, and Flannel can start normally.

But my requirement is to support both IPv4 and IPv6, with communication between Pods and Nodes prioritizing IPv6.

@wuyanfeiwork
Copy link
Author

---
apiVersion: kubeadm.k8s.io/v1beta3
kind: ClusterConfiguration
networking:
  podSubnet: 10.244.0.0/16,2001:db8:42:0::/56
  serviceSubnet: 2001:db8:42:1::/112,10.96.0.0/16
imageRepository: "localhost:5000"
kubernetesVersion: "1.25.4"
---
apiVersion: kubeadm.k8s.io/v1beta3
kind: InitConfiguration
localAPIEndpoint:
  advertiseAddress: "2408:4002:116a:0:6c2a:43c9:80c0:6664"
  bindPort: 6443
nodeRegistration:
  kubeletExtraArgs:
    node-ip: 2408:4002:116a:0:6c2a:43c9:80c0:6664,192.168.0.1

I reset the Kubernetes cluster, and then moved the IPv4 address in the podSubnet parameter of the kubeadm-config.yaml file, 10.244.0.0/16, to the front, ahead of the IPv6 address 2001:db8:42:0::/56, and re-initialized the Kubernetes cluster. Now flannel starts up normally.

I don’t quite understand why this is?

@rbrtbnfgl
Copy link
Contributor

rbrtbnfgl commented Jun 5, 2024

Is it prioritizing the IPv6? I tried to read the logs and it's strange that you didn't get the IPv4 there; it should get both IPs independently from the order. To prioritize IPv6 I think that it's enough the order of node-ip on the Kubelet args.

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

2 participants