Sometimes we don't want the kubernetes cluster to automatically  assign an IP address to a clusterIP service.

We want to assign a specific IP address to it.
If we already have an IP address, and we want to reuse it for our clusterIP service, we could specify it in the Yaml file as below:


But when we run the below command, we get an error that says that the chosen IP address is not within the valid range.


To know the range of the valid IP addresses, we use the below command:


We could then replace the spec.clusterIP field with a valid IP address and reapply the changes by running the "kubectl apply ..." command.
Brando Sabatini and Ikbal C ©. Powered by Blogger.