<p>I just installed k8s cluster but the URLs are all using localhost and would like to change it to use the hostname or even IP address. Due to this the cluster can be accessed only from the master node. I am unable to find the right place to make this change. Any help is really appreciated.    </p>

<pre><code>OS: Redhat 7.1
Kubernetes version: 1.2

[rakeshk@ kubernetes]$ kubectl cluster-info
Kubernetes master is running at http://localhost:8080
Elasticsearch is running at http://localhost:8080/api/v1/proxy/namespaces/kube-system/services/elasticsearch-logging
Heapster is running at http://localhost:8080/api/v1/proxy/namespaces/kube-system/services/heapster
Kibana is running at http://localhost:8080/api/v1/proxy/namespaces/kube-system/services/kibana-logging
KubeDNS is running at http://localhost:8080/api/v1/proxy/namespaces/kube-system/services/kube-dns
kubedash is running at http://localhost:8080/api/v1/proxy/namespaces/kube-system/services/kubedash
kubernetes-dashboard is running at http://localhost:8080/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard
Grafana is running at http://localhost:8080/api/v1/proxy/namespaces/kube-system/services/monitoring-grafana
InfluxDB is running at http://localhost:8080/api/v1/proxy/namespaces/kube-system/services/monitoring-influxdb
</code></pre>

<p>Based on the port number (<code>8080</code>, which is the default value of <a href="http://kubernetes.io/docs/admin/kube-apiserver/" rel="nofollow noreferrer"><code>--insecure-port</code></a> of <code>kube-apiserver</code>), I am guessing that you are running the <code>kubectl cluster-info</code> command on the same machine where the <code>kube-apiserver</code> is running.</p>

<p>If the above assumption is correct, then copy the <code>/etc/kubernetes/admin.conf</code> file (from the machine thats running the <code>kube-apiserver</code>) to your local machine <code>~/.kube/config</code>. Run <code>kubectl cluster-info</code> on your local machine (install <a href="http://kubernetes.io/docs/user-guide/prereqs/" rel="nofollow noreferrer">kubectl</a> program on your local machine, if you haven't already). This should give you cluster address as either a hostname or IP address. Whether it shows it as an IP address or a hostname depends on whether a reverse lookup of the IP address resolves a DNS record.</p>

<blockquote>
  <p>If you are initialising <a href="/questions/tagged/kubernetes" class="post-tag" title="show questions tagged &#39;kubernetes&#39;" rel="tag"><img src="https://i.stack.imgur.com/8UH0j.png" height="16" width="18" alt="" class="sponsor-tag-img">kubernetes</a> using <a href="/questions/tagged/kubeadm" class="post-tag" title="show questions tagged &#39;kubeadm&#39;" rel="tag">kubeadm</a> program. <code>kubeadm init</code> will autodetect the network interface to advertise the master on as the interface with the default gateway. If default gateway IP address is not routable IP address, ensure that you set <code>--api-advertise-addresses</code> to a routable IP address. </p>
</blockquote>
