<p>So I am having an issue where I get ERR_CONNECTION_REFUSED when I try to make a call from my frontend which is setup as an Ingress. My backend express server is running on port 5000 and is setup as ClusterIP. I've read the docker for mac local cluster ip is the same as localhost so thats how I have it set.</p>

<p>I am confident I have the files and networking correctly. I am just not sure where to aim the API call to the backend. Is it also localhost? I will include the files below.</p>

<p>Frontend deployment</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: frontend-deployment
spec:
  selector:
    matchLabels:
      app: frontend
  template:
    metadata:
      labels:
        app: frontend
    spec:
      containers:
      - name: frontend-container
        image: mrich6347/vue-frontend:5
        resources:
          requests:
            memory: "32Mi"
            cpu: "100m"
          limits:
            memory: "128Mi"
            cpu: "500m"
        ports:
        - containerPort: 8080
</code></pre>

<p>Frontend service</p>

<pre><code>apiVersion: v1
    kind: Service
    metadata:
      name: frontend-service
    spec:
      type: ClusterIP
      selector:
        app: frontend
      ports:
      - port: 8080
        targetPort: 8080
</code></pre>

<p>Express server deployment</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: express-server-deployment
spec:
  selector:
    matchLabels:
      app: express-server
  template:
    metadata:
      labels:
        app: express-server
    spec:
      containers:
      - name: express-server
        image: mrich6347/express-server:5
        resources:
          requests:
            memory: "32Mi"
            cpu: "100m"
          limits:
            memory: "128Mi"
            cpu: "500m"
        ports:
        - containerPort: 5000
</code></pre>

<p>Express server service</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: express-server-service
spec:
  type: ClusterIP
  selector:
    app: express-server
  ports:
  - port: 5000
    targetPort: 5000
</code></pre>

<p>Here is my api call from vue</p>

<pre><code>export default {
  name: 'app',
  components: {
    HelloWorld
  },
  created: async () =&gt; {
    console.log("SERVER IS UP")
    let res = await axios.get("http://127.0.0.1:5000/test");
    console.log(res)
  }
}
</code></pre>

<p>And finally my simple express API</p>

<pre><code>const app = require('express')();
var cors = require('cors')

app.use(cors())

app.get("/test", (req, res) =&gt; {
    res.send("WORKING!")
})


app.listen(5000, () =&gt; {
    console.log("Server is up on 5000")
})
</code></pre>

<p>Ingress Controller</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: traffic-router
  annotations:
    ingress.kubernetes.io/rewrite-target: /


spec:
  rules:
    - http:
        paths:
          - path: /
            backend:
              serviceName: frontend-service
              servicePort: 8080
</code></pre>

matt
<blockquote>
  <p>I've read the docker for mac local cluster ip is the same as localhost so thats how I have it set</p>
</blockquote>

<p>Services inside Docker for Mac Kubernetes are not directly available to your desktop. There are many Cluster IP's and only one <code>localhost</code> so if they were all exposed you would run into port conflicts on localhost pretty quickly. </p>

<p>Docker for Mac will automagically expose services with type <a href="https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#using-kubectl" rel="nofollow noreferrer"><code>LoadBalancer</code></a> on <code>localhost</code>. The concept is similar to running <code>docker run -p 80:30843 ...</code>. See the <code>EXTERNAL-IP</code> on this ingress controller. </p>

<pre><code>$ kubectl get service m-nginx-nginx-ingress-controller
NAME                               TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
m-nginx-nginx-ingress-controller   LoadBalancer   10.108.201.47   localhost     80:30843/TCP,443:31419/TCP   22h
</code></pre>

<pre><code>$ curl http://localhost:80
default backend - 404
</code></pre>

<p>As it sounds like you already have an ingress controller for your front end service, it's easiest to reuse that ingress and map another host name or URI path through to your backend service. </p>
