docker-elasticsearch-kubernetes icon indicating copy to clipboard operation
docker-elasticsearch-kubernetes copied to clipboard

Disable Java DNS (for-ever-)Cache, which prevents discovery of moving masters

Open rudibatt opened this issue 7 years ago • 0 comments

The base image doesn't change the default Java DNS cache setting, which is set to "cache for ever". This is not the desired behaviour in a kubernetes setup, where the IP adresses of the pods can change because of rescheduling, draining etc. Unfortunately it's not realy possible (just with a deprecated option) to overwrite that behaviour with java startup parameters. See https://stackoverflow.com/a/17219327/1460924

I'd suggest that either during image creation or at the docker-entrypoint.sh (at the base image) the "networkaddress.cache.ttl" setting is set to a value >= 0, for example:

sed -i 's/.*networkaddress.cache.ttl.*/networkaddress.cache.ttl=60' \
/usr/lib/jvm/default-jvm/jre/lib/security/java.security

rudibatt avatar Oct 31 '18 14:10 rudibatt