title: Expose cluster in k8s on localhost
body: <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>