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

SLAAC IPAM #1016

Open
maxpain opened this issue Mar 7, 2024 · 4 comments
Open

SLAAC IPAM #1016

maxpain opened this issue Mar 7, 2024 · 4 comments

Comments

@maxpain
Copy link

maxpain commented Mar 7, 2024

I use the macvlan plugin for Kubernetes, and my pods autoconfigure IPv6 addresses using SLAAC, but those addresses aren't exposed to Kubernetes.

How to achieve this?

@aojea
Copy link
Contributor

aojea commented Mar 8, 2024

they have to be returned as the response of the CNI ADD command

@s1061123
Copy link
Contributor

s1061123 commented Mar 8, 2024

they have to be returned as the response of the CNI ADD command

This issue is not just simple as above. In my conclusion, current CNI and Kubernetes does not support IPv6 SLAAC address.
There are several gaps between SLAAC, CNI and Kubernetes.

Current CNI plugin (at least, under https://github.com/containernetworking/plugins/) does not care IPv6 SLAAC address

SLAAC IP configuration is asynchronous to interface creation, actually. After interface creation, linux kernel will send a router solicitation and its reply (i.e. router advertisement) contains the network prefix, then IP autoconfiguration (i.e. DAD, duplicated address ditection) is started. Hence even though CNI plugin finishes their task, SLAAC process may be still on going.
(That is why submitter files the issue, I guess but there are still several technical challenges...)

SLAAC may change the IP address, but Kubernetes/CNI cannot have a way to track the changes

SLAAC provide a method to configure IPv6 address automatically based on prefix advertised by a local router, hence if the router provides different prefix then Pod's address will automatically re-configured (i.e. changed). Currently CNI plugins are only invoked at Pod creation and Pod deletion, hence Kubernetes does not capture Pod's re-configured address.

SLAAC may have multiple IP address to an interface but Kubernetes does not support multiple IPv6 address for a Pod

SLAAC, defined in https://tex2e.github.io/rfc-translater/html/rfc7217.html, introduces multiple IPv6 address to an interfaces. If user network has two or more network prefix, an interface has two or more IPv6 addresses, for each network prefix. In addition, even if user network has only one network prefix, "temporary addresses" is assigned to an interfaces, additionally. So IPv6 and SLAAC are designed to have multiple IP addresses in an interface.

But on the other side, current Kubernetes only supports one IP address for each protocol (i.e. IPv4/v6). Hence Kubernetes cannot handle multiple IPv6 address.

As of above reasons, currently SLAAC IPv6 address is not handling in Kubernetes/CNI yet.

@aojea
Copy link
Contributor

aojea commented Mar 8, 2024

Let me explain myself better, kubernetes pods are ephemeral, the lifecycle of a Pod is start -> run -> stop, so there is no concept of dynamic IPs on Pods. It will be interesting to know your use case for having a Pod that is running and changing IPs though ...

If you want to represent an IP address to kubernetes , as in pod.status.PodIP, it has to be returned as the response of the CNI ADD , it is up to the plugin implementation how to obtain this IP, you can use dhcp, slaac or static IP assignment to get this IP , but kubernetes will be only aware of the IP that is in the response of the CNI ADD

@squeed
Copy link
Member

squeed commented Mar 11, 2024

I actually wrote a SLAAC ipam plugin once, and it totally worked. (The branch is long gone, that laptop is like 3 acquisitions old 😆). The basic step was:

  1. Bring up interface
  2. Wait for SLAAC
  3. Disable SLAAC, "manually" IP address and routes to interface (to remove from SLAAC lifecycle)
  4. Return IP in CNI status

It totally worked! If you want to re-create it, I'd be happy to merge it.

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

4 participants