<p>Because docker supports out of the box kubernetes (on my Mac) I thought I try it out and see if I can load balance a simple webservice. For that, I created a simple image, which exposes port 3000 and only returns <code>Hello World</code>. And I created a k8s config yaml</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: hello-kubernetes
spec:
  type: NodePort
  externalIPs:
  - 192.168.2.85
ports:
  - port: 8080
    targetPort: 3000
selector:
  app: hello-kubernetes
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-kubernetes
spec:
  replicas: 3
  selector:
    matchLabels:
      app: hello-kubernetes
  template:
    metadata:
      labels:
        app: hello-kubernetes
    spec:
      containers:
        - name: hello-kubernetes
          image: hello/world:latest
          ports:
            - containerPort: 3000
</code></pre>

<p>Apply it</p>

<pre><code>$&gt; kubectl apply -f ./example.yaml
</code></pre>

<p>I see 3 pods running, and a service</p>

<pre><code>NAME               TYPE        CLUSTER-IP      EXTERNAL-IP    PORT(S)          AGE
hello-kubernetes   NodePort    10.99.38.46     192.168.2.85   8080:30244/TCP   42m
</code></pre>

<p>I've used NodePort above, but I'm not sure if I can use <code>Loadbalancer</code> here as well.</p>

<p>Anyway, in the browser I get the message <code>This site can’t be reached</code> when I goto <code>http://192.168.2.85:8080</code> or `<a href="http://192.168.2.85:30244" rel="nofollow noreferrer">http://192.168.2.85:30244</a> (I never know which port to use)</p>

<p>So, I think I'm close, but I still missed something :( Any help would be appreciated!</p>

Jeanluca Scaljeri
<pre><code>k explain service.spec.externalIPs
</code></pre>

<blockquote>
  <p>KIND:     Service VERSION:  v1</p>
  
  <p>FIELD:    externalIPs &lt;[]string></p>
  
  <p>DESCRIPTION:
       externalIPs is a list of IP addresses for which nodes in the cluster will
       also accept traffic for this service. These IPs are not managed by
       Kubernetes. The user is responsible for ensuring that traffic arrives at a
       node with this IP. A common example is external load-balancers that are not
       part of the Kubernetes system.</p>
</blockquote>

<p>Problem here is we don't know your network settings. IS this minikube for mac? Is the 192.168.2.x network reachable for you? In my case using minikube all I had to do was to edit the externalIP to be reachable from my network. So what I did to get this working was:</p>

<ul>
<li><code>minikube IP</code> in my case 192.168.99.100 (IP address of minikubeVM) </li>
<li><p>changed externalIP to 192.168.99.100</p>

<p><code>k get svc
NAME               TYPE        CLUSTER-IP       EXTERNAL-IP      PORT(S)          AGE
hello-kubernetes   NodePort    10.105.212.118   192.168.99.100   8080:32298/TCP   46m</code></p></li>
</ul>

<p>And I was able to reach the application using <code>192.168.99.100:8080</code>. </p>

<p>Also note that in your case you have 8081 port (But I guess P Ekambaram already mentioned this). </p>
