<p>I'm freshman on microk8s, and I'm trying out things by deploying a simple apache2 to see things working on my Mac M1:</p>
<pre><code>◼ ~ $ microk8s kubectl run apache --image=ubuntu/apache2:2.4-22.04_beta --port=80
pod/apache created
◼ ~ $ microk8s kubectl get pods
NAME                                   READY   STATUS             RESTARTS       AGE
apache                                 1/1     Running            0              5m37s
◼ ~ $ microk8s kubectl port-forward pod/apache 3000:80
Forwarding from 127.0.0.1:3000 -&gt; 80
</code></pre>
<p>but:</p>
<pre><code>◼ ~ $ curl http://localhost:3000
curl: (7) Failed to connect to localhost port 3000 after 5 ms: Connection refused
</code></pre>
<p>I've also tried to use a service:</p>
<pre><code>◼ ~ $ microk8s kubectl expose pod apache --type=NodePort  --port=4000 --target-port=80
service/apache exposed
◼ ~ $ curl http://localhost:4000
curl: (7) Failed to connect to localhost port 4000 after 3 ms: Connection refused
</code></pre>
<p>I guess I'm doing something wrong?</p>

Bertuz
<p>For some reason I haven't figured it out, if I port-forward right within the VM by opening a shell via multipass, it does work. Next, you simply have to point to the VM's IP:</p>
<p>within a VM's shell:</p>
<pre><code>ubuntu@microk8s-vm:~$ sudo microk8s kubectl port-forward service/hellopg 8080:8080 --address=&quot;0.0.0.0&quot;
Forwarding from 0.0.0.0:8080 -&gt; 8080
Handling connection for 8080

ubuntu@microk8s-vm:~$ ifconfig enp0s1
enp0s1: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500
        inet 192.168.64.2  netmask 255.255.255.0  broadcast 192.168.64.255
        inet6 fde3:1a04:ba31:1209:5054:ff:fea9:9cf4  prefixlen 64  scopeid 0x0&lt;global&gt;

</code></pre>
<p>from the host:</p>
<pre><code> curl http://192.168.64.2:8080/hello                                                                                                                                                                                                                   7
{&quot;status&quot;: &quot;how you doing?&quot;, &quot;env_var&quot;:&quot;¡hola mundo!&quot;}
</code></pre>
<p>it works. I guess the command via <code>microk8s</code> is not executed properly within the machine? If anybody can explain this I'll update the question</p>
