<p>I am playing with Kubernetes on <a href="https://labs.play-with-k8s.com" rel="nofollow noreferrer">https://labs.play-with-k8s.com</a>.<br>
I tried to use the <code>kubectl proxy</code> following the instructions in <a href="https://kubernetes.io/docs/tasks/access-kubernetes-api/http-proxy-access-api/#using-kubectl-to-start-a-proxy-server" rel="nofollow noreferrer">Kubernete's website</a>.<br>
On the Master node (192.168.0.13) I ran: <code>kubectl proxy --port=8080</code>:  </p>

<pre><code>[node1 ~]$ kubectl proxy --port=8080
Starting to serve on 127.0.0.1:8080
</code></pre>

<p>On the Worker node I ran <code>curl -v http://192.168.0.13:8080</code> and it failed:  </p>

<pre><code>[node2 ~]$ curl -v http://192.168.0.13:8080
* About to connect() to 192.168.0.13 port 8080 (#0)
*   Trying 192.168.0.13...
* Connection refused
* Failed connect to 192.168.0.13:8080; Connection refused
* Closing connection 0
curl: (7) Failed connect to 192.168.0.13:8080; Connection refused
</code></pre>

<p>Any idea why the connection is refused ?  </p>

E235
<blockquote>
  <p>Starting to serve on 127.0.0.1:8080</p>
</blockquote>

<p>As shown in the message it emits on startup, that is because <code>kubectl proxy</code> <strong>only</strong> listens on localhost (i.e. <code>127.0.0.1</code>), unless you instruct it otherwise:</p>

<pre><code>kubectl proxy --address=0.0.0.0 --accept-hosts='.*'
</code></pre>

<p>and that <code>--accept-hosts</code> business is a regular expression for hosts (presumably <code>Referer</code> headers? DNS lookups?) from which <code>kubectl</code> will accept connections, and <code>.*</code> is a regex that matches every string including the empty ones.</p>
