<p>I have two deployments, one for backend and one for frontend and two services for them. Frontend Service is set as a LoadBalancer and it is exposed as expected(using minikube tunnel). Backend service shouldnt be exposed outside of the cluster, therefore I didnt set any type of service(default is ClusterIP which is available only within a cluster). Now I would like to make calls from frontend to backend. When I type </p>

<pre><code>kubectl exec -it FRONT_END_POD_NAME -- /bin/sh
</code></pre>

<p>And then use <code>curl</code> I can get all resources which I expect, however, when I open my website application which fetches the same resource as I type in curl, there is an error in console <code>net::ERR_NAME_NOT_RESOLVED</code>. Do You have any idea why is that happening, even when I am able to curl it from my frontend and everything works? How to fix it?</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend-deployment
  labels:
    app: backend
spec:
  selector:
    matchLabels:
      app: backend
  replicas: 1
  template:
    metadata:
      labels:
        app: backend
    spec:
      containers:
        - name: backend
          image: ajris/site_backend:pr-kubernetes
          ports:
            - containerPort: 8080
====
apiVersion: v1
kind: Service
metadata:
  name: backend-service
  labels:
    app: backend
spec:
  selector:
    app: backend
  ports:
    - protocol: TCP
      port: 8081
      targetPort: 8080
===
apiVersion: apps/v1
kind: Deployment
metadata:
  name: frontend-deployment
  labels:
    app: frontend
spec:
  selector:
    matchLabels:
      app: frontend
  replicas: 1
  template:
    metadata:
      labels:
        app: frontend
    spec:
      containers:
        - name: frontend
          image: ajris/site_frontend:travis-66
          ports:
            - containerPort: 3000
          imagePullPolicy: Always
===
apiVersion: v1
kind: Service
metadata:
  name: frontend-service
  labels:
    app: frontend
spec:
  ports:
    - protocol: TCP
      port: 3001
      targetPort: 3000
  selector:
    app: frontend
  type: LoadBalancer

</code></pre>

Hubert Bratek
<p>Since this doesn't have an section answer yet, might as well make it easier for others to find it in the future. The person who asked the question answered it themselves here in the comments of the question.</p>
<p>Essentially what's happening here is, that React doesn't execute on the frontend pod, but in the browser of the client. Thus any request that tries to contact the backend pod will fail if it's not reachable by the client such as is the case with a backend pod with a ClusterIP service.</p>
<p>To solve this issue, the backend server needs to be accessible from the client. This can be done by changing the service that is associated with the backend pod to a LoadBalancer or by using an ingress.</p>
