<p>I have this in a <code>selenium-hub-service.yml</code> file:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: selenium-srv
spec:
  selector:
    app: selenium-hub
  ports:
  - port: 4444
    nodePort: 30001
  type: NodePort
  sessionAffinity: None
</code></pre>
<p>When I do <code>kubectl describe service</code> on terminal, I get the endpoint of kubernetes service as <code>192.168.49.2:8443</code>. I then take that and point the browser to <code>192.168.49.2:30001</code> but browser is not able to reach that endpoint. I was expecting to reach selenium hub.</p>
<p>When I do <code>minikube service selenium-srv --url</code>, which gives me <code>http://127.0.0.1:56498</code> and point browser to it, I can reach the hub.</p>
<p>My question is: why am I not able to reach through <code>nodePort</code>?</p>
<p>I would like to do it through <code>nodePort</code> way because I know the port beforehand and if kubernetes service end point remains constant then it may be easy to point my tests to a known endpoint when I integrate it with azure pipeline.</p>
<p>EDIT: output of <code>kubectl get service</code>:</p>
<pre><code>NAME           TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
kubernetes     ClusterIP   10.96.0.1      &lt;none&gt;        443/TCP          4d
selenium-srv   NodePort    10.96.34.117   &lt;none&gt;        4444:30001/TCP   2d2h
</code></pre>

<p>Posted community wiki based on <a href="https://github.com/kubernetes/minikube/issues/11193" rel="nofollow noreferrer">this Github topic</a>. Feel free to expand it.</p>
<p>The information below assumes that you are using <a href="https://minikube.sigs.k8s.io/docs/drivers/docker/" rel="nofollow noreferrer">the default driver docker</a>.</p>
<hr />
<p>Minikube on macOS behaves a bit differently than on Linux. While on Linux, you have special interfaces used for docker and for connecting to the minikube node port, like this one:</p>
<pre><code>3: docker0:
...
inet 172.17.0.1/16
</code></pre>
<p>And this one:</p>
<pre><code>4: br-42319e616ec5:
...
inet 192.168.49.1/24 brd 192.168.49.255 scope global br-42319e616ec5
</code></pre>
<p>There is no such solution implemented on macOS. <a href="https://github.com/kubernetes/minikube/issues/11193#issuecomment-826331511" rel="nofollow noreferrer">Check this</a>:</p>
<blockquote>
<p>This is a known issue, Docker Desktop networking doesn't support ports. You will have to use minikube tunnel.</p>
</blockquote>
<p><a href="https://github.com/kubernetes/minikube/issues/11193#issuecomment-826708118" rel="nofollow noreferrer">Also</a>:</p>
<blockquote>
<p>there is no bridge0 on Macos, and it makes container IP unreachable from host.</p>
</blockquote>
<p>That means you can't connect to your service using IP address <code>192.168.49.2</code>.</p>
<p>Check also this article: <a href="https://docs.docker.com/desktop/mac/networking/#known-limitations-use-cases-and-workarounds" rel="nofollow noreferrer">Known limitations, use cases, and workarounds - Docker Desktop for Mac</a>:</p>
<blockquote>
<p><strong>There is no docker0 bridge on macOS</strong>
Because of the way networking is implemented in Docker Desktop for Mac, you cannot see a  <code>docker0</code>  interface on the host. This interface is actually within the virtual machine.</p>
</blockquote>
<blockquote>
<p><strong>I cannot ping my containers</strong>
Docker Desktop for Mac can’t route traffic to containers.</p>
</blockquote>
<blockquote>
<p><strong>Per-container IP addressing is not possible</strong>
The docker (Linux) bridge network is not reachable from the macOS host.</p>
</blockquote>
<p>There are few ways to <a href="https://github.com/kubernetes/minikube/issues/11193#issuecomment-826708118" rel="nofollow noreferrer">setup minikube to use NodePort at the localhost address on Mac, like this one</a>:</p>
<pre><code>minikube start --driver=docker --extra-config=apiserver.service-node-port-range=32760-32767 --ports=127.0.0.1:32760-32767:32760-32767`
</code></pre>
<p>You can also use <code>minikube service</code> command which will return a URL to connect to a service.</p>
