<p>This is my <code>Service</code> and <code>Deployment</code> yaml that I am running on <code>minikube</code>:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: node-hello-world
  labels:
    app: node-hello-world
spec:
  replicas: 1
  selector:
    matchLabels:
      app: node-hello-world
  template:
    metadata:
      labels:
        app: node-hello-world
    spec:
      containers:
      - name: node-hello-world
        image: node-hello-world:latest
        imagePullPolicy: Never
        ports:
        - containerPort: 8080

---
apiVersion: v1
kind: Service
metadata:
  name: node-hello-world-load-balancer
spec:
  type: LoadBalancer
  ports:
  - protocol: TCP
    port: 9000
    targetPort: 8080
    nodePort: 30002
  selector:
    name: node-hello-world
</code></pre>

<p>Results:</p>

<pre><code>$ minikube service node-hello-world-load-balancer --url
http://192.168.99.101:30002
$ curl http://192.168.99.101:30002
curl: (7) Failed to connect to 192.168.99.101 port 30002: Connection refused
</code></pre>

<p>However, running the following CLI worked:</p>

<pre><code>$ kubectl expose deployment node-hello-world --type=LoadBalancer
$ minikube service node-hello-world --url
http://192.168.99.101:30130
$ curl http://192.168.99.101:30130
Hello World!
</code></pre>

<p>What am I doing wrong with my LoadBalancer yaml config?</p>

nubela
<p>you have configured wrong the service selector </p>

<pre><code>selector:
name: node-hello-world
</code></pre>

<p>it should be:</p>

<pre><code>selector:
app: node-hello-world
</code></pre>

<p><a href="https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/" rel="nofollow noreferrer">https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/</a></p>

<p>you can debug this by describing the service, and seeing that the endpoint list is empty, so there are no pods mapped to your endpoint's service list </p>

<pre><code>kubectl describe svc node-hello-world-load-balancer | grep -i endpoints
Endpoints:                &lt;none&gt;
</code></pre>
