Sasa
Sasa

Reputation: 1757

Kubernetes: reserving subrange of service-cluster-ip-range for manual allocation

When creating a service, I can either specify static IP address from cluster IP range or don't specify any IP address in which case such address will be dynamically assigned.

But when specifying static IP address, how can I make sure that it will not conflict with existing dynamically assigned IP address? I could for example programmatically query if such IP address is already in use. Or, what I would more prefer is to specify IP range that is cluster-wise reserved for manual allocation. For example

Now, I can manage IP address in range from 10.20.5.0-10.22.5.255 myself and kubernetes can use remaining pool for dynamic allocation. Sort of how usually DHCP/static IP range works on home routers.

Is this scenario possible in kubernetes?

Upvotes: 6

Views: 1670

Answers (2)

not-a-robot
not-a-robot

Reputation: 321

ServiceIPStaticSubrange can be used to reduce the risk of getting such IPs allocated

Upvotes: 0

Ralph
Ralph

Reputation: 41

The service ip you manually select has to be part of the selected range or you'll receive an invalid (422) response from kubernetes. The kubernetes documentation has a choosing your own ip section for services. If you have admin rights to the cluster the easiest option is going to perform kubectl get services --all-namespaces which will show you every service provisioned in your cluster with its corresponding CLUSTER-IP shown.

Upvotes: 1

Related Questions