Allocating Service IP Addresses within the Node's IP Address range

Cluster information:

Kubernetes version: 1.21
Cloud being used: No
Installation method: manual
Host OS: Centos 8.2
CNI and version: calico 0.3.1
CRI and version:

Hi Colleagues,
It is necessary to make a Kubernetes cluster to work in a way, where the Services IP Addresses (and Cluster IP addresses) are allocated from the IP Subnet of the Kubernetes Nodes itself.
Can you please help with some tips, advices or manual to implement this solution.
Thank you & Regards.

You want the cluster network to share infrastructure addressing?

There might be some insight regarding your goals in the cluster networking documentation. Any limitations that exists seem to be specific to the CNI’s available.

Hi protosam, thank you for the replay!
yes this is the goal (to share the infrastructure and cluster segment / IP space).
the CNI could be calico or flannel. Is there such of possibility ?

Calico seems to have quite a few configuration options available: Configure Networking

I truly don’t know though, my networking knowledge is pretty basic.

There isn’t really a packaged way to do this. The service REST stack will allocate IPs from a range you give it. It does not really have a way to coordinate with an external IPAM.

Now, of course there may be hacks possible. The service REST will accept IPs you give it if they are in-range and not “busy”. So in theory you could write a we hook admission for Service which reaches out to your own IPAM to allocate an IP, and fill that in on the Service. You’d have to lie to the API server and give it a range to “manage” which covered those IP addresses.

But why? Service IPs are (usually) virtual. They can use almost any valid range.

Hi thockin,
Thank you for the replay and the suggestions, probably will try to implement them soon.
The point is that, I deal with kubernetes since a few days and looked for quick solution to overcome the network complexity (especially the frontend service and loadbalancing).
However it seems I will need to deal intensively with the networking concepts and their capabilities.
Currently I already have good overview about NodePort capabilities, and probably will align the solution with it.
Thank you!

Hi protosam,
nice link. There I found a lot of information and some more interesting ideas.
The information will help me , however in this specific case I have decided do not push the limits of the CNI capabilities.
Thank you for the help here, Appreciate!