How to assign a range of ip to my pods under a namespace?

I want to make sure, my pods under a namespace are assigned a specific ip addresses. Can anyone help me on how may I do this!

Static IPs for pods is generally considered an anti-pattern, services are the means in which you create a “static” mapping to one or more pods so that you can upgrade/downgrade/scale without having to change anything within your application.

If you really do need to create a static IP for a pod, it’s not something Kubernetes directly supports. Some CNI do however e.g. Calico.

1 Like

Agreeing with Bob. In general, you can’t describe a namespace with a single CIDR or even an arbitrary netmask. Many/most implementations do pod IPAM by pre-allocating a range to a node. When pods run, they take single IPs from the per-node range on whichever node they run. Some implementations don’t pre-allocate per-node, which can maybe do what you want, but you need a separate place to allocate and track per-namespace ranges.

1 Like

Hey @mrbobbytables, @thockin , Thanks for your response.