Service discovery in case of kubernetes service recreation/restarts

4/19/2017

It is a followup question to an earlier asked SO question regarding stability of serviceIP. I understand that in general, serviceIP are stable, but my case is the one where service gets often restarted, like for port changes.

using DNS is not the perfect solution in this case as client pods can cache the DNS entry. So, i wanted to know the best practice around this.

-- prat0318
dns
kubernetes
service
service-discovery

1 Answer

4/19/2017

The service IP can be defined as a fixed IP by setting the spec.clusterIP field.

The IP address that a user chooses must be a valid IP address and within the service-cluster-ip-range.

It would be recommended to either use automatic IP addresses for all services or manage the service IPs of all services manually.

For more info please see the official docs.

-- Oswin Noetzelmann
Source: StackOverflow