<p>Consider if we build two VMs in a bare-metal server through a network, one is <strong>master</strong> and another is <strong>worker</strong>. I <code>ssh</code> to the master and construct a cluster using <code>kubeadm</code> which has three pods and a service with <code>type: ClusterIP</code>. So when I want access to the cluster I do <code>kubectl proxy</code> in the master. Now we can explore the API with <code>curl</code> and <code>wget</code> in the VM which we <code>ssh</code> to it, like this :</p>

<pre><code>$ curl http://localhost:8080/api/
</code></pre>

<p>So far, so good! but I want access to the services by my laptop? The localhost which comes above is refer to the bare-metal server! How can access to the services through proxy by my laptop when cluster is placed in another machine? </p>

<p>When I do <code>$ curl http://localhost:8080/api/</code> in my laptop it says :
 <code>127.0.0.1 refused to connect</code> 
which make sense! But what is the solution to this?</p>

Majid Rajabi
<p>If you forward the port 8080 when sshing to master, you can use localhost on your laptop to access the apis on the cluster. </p>

<p>You can try adding the <code>-L</code> flag to your <code>ssh</code> command:</p>

<p><code>$ ssh -L 8080:localhost:8080 your.master.host.com
</code></p>

<p>Then the <code>curl</code> to <code>localhost</code> will work. </p>
