<p>I have deployed a very simple node application to a minikube cluster. I created the docker image and everything is working fine while in the container. When I build it in the k8s cluster, I can see the deployment is working.</p>
<p>I am trying to access the node application through a load balancer using the minikube IP and port provided when running &quot;kubectl get svc&quot;. I know I'm doing this part correct at least...</p>
<p>When I try to access the URL and check the network tab, the request never finishes and just stays pending.</p>
<p>The node app is a very simple API I made just for testing so I use the route /posts when trying to access the application. It should return some JSON and this all works from the container. It all just stops working while in the cluster.</p>
<pre class="lang-yaml prettyprint-override"><code>
apiVersion: apps/v1
kind: Deployment
metadata: 
  name: server-deployment
spec: 
  replicas: 3
  selector: 
    matchLabels: 
      targets: nodes
  template: 
    metadata: 
      labels: 
        targets: nodes
    spec: 
      containers: 
        - name: server
          image: brandonjones085/mean-backend
          ports: 
            - containerPort: 3000

---
apiVersion: v1
kind: Service
metadata:
  name: backend-load
spec:
  selector:
  
    targets: nodes
  ports:
  - protocol: &quot;TCP&quot;
    port: 3000
    targetPort: 3000
  type: LoadBalancer
</code></pre>

Brandon Jones
<p>Just like @Hackerman described, if you using the <a href="https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/" rel="nofollow noreferrer">LoadBalancer</a> type of service you need to use <code>minikube tunnel</code>. You can follow the <a href="https://minikube.sigs.k8s.io/docs/handbook/accessing/#example" rel="nofollow noreferrer">example</a>. This type of service is usually meant to provision a provider Load Balancer, for example, an <a href="https://aws.amazon.com/elasticloadbalancing/" rel="nofollow noreferrer">AWS ELB</a>. But in the case of minikube there is no external provider and you need to trick it into thinking there is one.</p>
<p>Basically, you need to run it before you create your Deployment.</p>
<p>On a separate terminal:</p>
<pre class="lang-sh prettyprint-override"><code>minikube tunnel
</code></pre>
<p>Then apply your manifest YAML file that includes your definition in your question:</p>
<pre class="lang-sh prettyprint-override"><code>kubectl apply -f &lt;your-deployment&gt;.yaml
</code></pre>
<p>✌️</p>
