add fixes for kubernetes to server.js
add backward compat to server.js finding of master for non-Kuberetes env