<p>I have a testing Kubernetes cluster  running in remote VMs (on VSphere), I have full access to the VMs through <code>ssh</code> (they have private IPs). How can I expose services and access them from outside the cluster (from my remote laptop trying to get access to the machines) knowing that I can remotely perform all kubectl commands.</p>

<p>For example: I tried with the dashboard, I installed it, I have changed the service to NodePort, and I tried to access to it from my laptop using this URL <code>http:master-private-ip:exposedport</code>, also with worker IPs, but it does not work. It returns in browser only <code>�</code> (binary output). When I try to connect through <code>https</code>, it trows a certificates error.</p>

<pre><code>$ kubectl get svc -n kube-system -l k8s-app=kubernetes-dashboard
  NAME                   TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)         AGE
  kubernetes-dashboard   NodePort       10.97.143.110    &lt;none&gt;        443:30714/TCP   42m
$ kubectl  proxy -p 8001
$ curl http://172.16.5.226:30714 --output -
</code></pre>

<p>I have expected that the output shows me the <code>html</code> from the UI of the Kubernetes dashboard</p>

<blockquote>
  <p>NOTE: Dashboard should not be exposed publicly over HTTP. For domains accessed over HTTP it will not be possible to sign in. Nothing will happen after clicking Sign in button on login page.</p>
</blockquote>

<p>If you have done everything correctly it should work over <code>HTTPS</code></p>

<p>As it's explained in <a href="https://github.com/kubernetes/dashboard/wiki/Accessing-Dashboard---1.7.X-and-above" rel="nofollow noreferrer">Accessing Dashboard 1.7.X and above</a>.</p>

<p>In order to expose Dashboard using <code>NodePort</code> you need to edit <code>kubernetes-dashboard</code> service.</p>

<p><code>kubectl -n kube-system edit service kubernetes-dashboard</code></p>

<p>Find <code>type: ClusterIP</code> and change it to <code>type: NodePort</code>, then save the file.</p>

<p>Then, check which port was the Dashboard exposed to:</p>

<p><code>kubectl -n kube-system get service kubernetes-dashboard</code>
which might look:</p>

<pre><code>NAME                   CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
kubernetes-dashboard   10.100.124.90   &lt;nodes&gt;       443:31707/TCP   21h
</code></pre>

<p>To access the Dashboard navigate your browser to <code>https://&lt;server_IP&gt;:31707</code></p>

<p><strong>EDIT:</strong></p>

<p>In your case with self-signed certificate, you need to put it into a secret. It has to be named <code>kubernetes-dashboard-certs</code> and it has to be in <code>kube-system</code> namespace.</p>

<p>You have to save the cert as <code>dashboard.crt</code> and <code>dashboard.key</code> and store them under <code>$HOME/certs</code>.</p>

<pre><code>kubectl create secret generic kubernetes-dashboard-certs --from-file=$HOME/certs -n kube-system
</code></pre>

<p>This installation process is explained <a href="https://github.com/kubernetes/dashboard/wiki/Installation#recommended-setup" rel="nofollow noreferrer">here</a>.</p>
