<p>Installed <code>microk8s</code> on VirtualBox guest with fresh Ubuntu-Server.
Exposed the kubernetes dahsboard through VirtualBox Port Forwarding but cannot connect from the VirtualBox's host machine.
Service address (last):</p>
<pre><code>NAMESPACE     NAME                                TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                  AGE
default       service/kubernetes                  ClusterIP   10.152.183.1     &lt;none&gt;        443/TCP                  11h
kube-system   service/kube-dns                    ClusterIP   10.152.183.10    &lt;none&gt;        53/UDP,53/TCP,9153/TCP   10h
kube-system   service/metrics-server              ClusterIP   10.152.183.103   &lt;none&gt;        443/TCP                  10h
kube-system   service/kubernetes-dashboard        ClusterIP   10.152.183.162   &lt;none&gt;        443/TCP                  10h

</code></pre>
<p><a href="https://i.stack.imgur.com/evPKh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/evPKh.png" alt="enter image description here" /></a></p>
<p>From the host dashboard is inaccessible:</p>
<pre><code>light@brahmand:~$ curl -vks https://127.0.1.1:7071
*   Trying 127.0.1.1:7071...
* TCP_NODELAY set
* Connected to 127.0.1.1 (127.0.1.1) port 7071 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* OpenSSL SSL_connect: Connection reset by peer in connection to 127.0.1.1:7071 
* Closing connection 0
</code></pre>
<p>However, from the guest dashboard is accessible:</p>
<pre><code>root@siddhalok:/home/light# curl -k https://10.152.183.162:443
&lt;!--...

--&gt;&lt;!DOCTYPE html&gt;&lt;html lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;&lt;head&gt;
  &lt;meta charset=&quot;utf-8&quot;&gt;
...
</code></pre>
<p>Firewall(s) is disabled:</p>
<pre><code>root@siddhalok:/home/light# systemctl status ufw
● ufw.service - Uncomplicated firewall
     Loaded: loaded (/lib/systemd/system/ufw.service; disabled; vendor preset: enabled)
     Active: inactive (dead)
       Docs: man:ufw(8)

Jan 22 04:49:17 siddhalok systemd[1]: Stopping Uncomplicated firewall...
Jan 22 04:49:17 siddhalok ufw-init[16758]: Skip stopping firewall: ufw (not enabled)
Jan 22 04:49:17 siddhalok systemd[1]: ufw.service: Succeeded.
Jan 22 04:49:17 siddhalok systemd[1]: Stopped Uncomplicated firewall.

root@siddhalok:/home/light# systemctl status firewalld
Unit firewalld.service could not be found.
</code></pre>
<p>Note, the other 2 ports are being forwarded fine, SSH to guest is working.</p>

noname7619
<p>kubectl port-forward is a feature of Kubernetes. It is not the port-forwarding from the Virtualbox ip.
A Kubernetes nodes have an Ipaddress, this should be in your case the VM where you have running Kubernetes. Inside the node Kubernetes creates it own Network on which the Pods run. This are the clusterIps. Those you camt access directly .</p>
<p>You have 3 choices</p>
<ol>
<li>Use Kubectl port-forward svc/serviceNAme hostPort:containerport.</li>
</ol>
<p>This is good for Testing.</p>
<ol start="2">
<li>Configure the service as type NodePort, this will create a port mapped to your containerPort which you can access with the VM Ip (Ip where Kubernetes node is running) kubernetesNodeIp:NodePort</li>
</ol>
<pre><code>kubectl get node

</code></pre>
<p>gives you the list of your nodes</p>
<pre><code>kubectl describe node &quot;nodeName&quot;
</code></pre>
<p>Inside the respose you can find the Ip on which the node is running.</p>
<p>Ping it to be sure you do not have Network issues.</p>
<ol start="3">
<li>Configure ingress and access through a domain name , even a fake one defined in your local hosts file. This requires much effort and an ingress controller must be installed on Kubernetes.</li>
</ol>
