<p>I've gone through a fair few stackoverflow posts, none are working... So here's my issue:</p>
<p>I've got a simple node app running on broadcast <code>0.0.0.0</code> at port <code>5000</code>, it's got a simple single endpoint at /.</p>
<p>I've got two k8s objects, here's my Deployment object:</p>
<pre class="lang-yaml prettyprint-override"><code>
### pf deployment
apiVersion: apps/v1
kind: Deployment
metadata:
    # Unique key of the Deployment instance
    name: pf-deployment
spec:
    # 3 Pods should exist at all times.
    replicas: 1
    selector:
        matchLabels:
            app: public-facing
    template:
        metadata:
            labels:
                # Apply this label to pods and default
                # the Deployment label selector to this value
                app: public-facing
        spec:
            containers:
                - name: public-facing
                  # Run this image
                  image: pf:ale8k
                  ports:
                    - containerPort: 5000
</code></pre>
<p>Next, here is my Service object:</p>
<pre class="lang-yaml prettyprint-override"><code>### pf service
apiVersion: v1
kind: Service
metadata:
  name: pf-service
  labels:
    run: pf-service-label
spec:
  type: NodePort ### may be ommited as it is a default type
  selector:
    name: public-facing ### should match your labels defined for your angular pods
  ports:
    - protocol: TCP
      targetPort: 5000 ### port your app listens on
      port: 5000 ### port on which you want to expose it within your cluster
</code></pre>
<p>Finally, a very simple dockerfile:</p>
<pre><code>### generic docker file
FROM node:12

WORKDIR /usr/src/app

COPY . .

RUN npm i

EXPOSE 5000

CMD [&quot;npm&quot;, &quot;run&quot;, &quot;start&quot;]
</code></pre>
<p>I have my image in the minikubes local docker registry, so that's not the issue...</p>
<p>When I try:
<code>curl $(minikube service pf-service --url)</code>
I get:
<code>curl: (7) Failed to connect to 192.168.99.101 port 31753: Connection refused</code></p>
<p>When I try:
<code>minikube service pf-service</code></p>
<p>I get a little further output:</p>
<pre><code>Most likely you need to configure your SUID sandbox correctly
</code></pre>
<p>I have the hello-minikube image running, this works perfectly fine. So I presume it isn't my nacl?</p>
<p>I'm very new to kubernetes, so apologies in advance if it's very simple.</p>
<p>Thanks!</p>

Ale8k
<p>Service has got selector <code>name: public-facing</code> but pod has got label  <code>app: public-facing</code>. They need to be same for <code>Endpoints</code> of the service to be populated with pod IPs.</p>
<p>If you execute below command</p>
<pre><code>kubectl describe svc pf-service
</code></pre>
<p>You will see that <code>Endpoints</code> has got no IPs which is the cause of <code>connection refused</code> error.</p>
<p>Change the selector in service as below to make it work.</p>
<pre><code>### pf service
apiVersion: v1
kind: Service
metadata:
  name: pf-service
  labels:
    run: pf-service-label
spec:
  type: NodePort ### may be ommited as it is a default type
  selector:
    app: public-facing ### should match your labels defined for your angular pods
  ports:
    - protocol: TCP
      targetPort: 5000 ### port your app listens on
      port: 5000 ### port on which you want to expose it within your cluster
</code></pre>
