<p>I'm new with Kubernetes and I tried to create two services that can communicate with each other. The first service is a simple static web (HTML, js) with type <code>LoadBalancer</code> and the second service is a express.js backend with the type <code>ClusterIP</code>. Here's my <code>service.yaml</code> file:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: number-generator
spec:
  selector:
    app: number-generator
  ports:
  - port: 3000
    targetPort: 3000
  type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
  name: number-web
spec:
  selector:
    app: number-web
  ports:
  - port: 80
    targetPort: 80
  type: LoadBalancer
</code></pre>
<p>And here's my <code>deployment.yaml</code> file:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: number-generator
spec:
  selector:
    matchLabels:
      app: number-generator
  template:
    metadata:
      labels:
        app: number-generator
    spec:
      containers:
      - name: number-generator
        image: cantdocpp/number-generator
        ports:
        - containerPort: 3000
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: number-web
spec:
  selector:
    matchLabels:
      app: number-web
  template:
    metadata:
      labels:
        app: number-web
    spec:
      containers:
      - name: number-web
        image: cantdocpp/number-web:v5
        ports:
        - containerPort: 80
</code></pre>
<p>So inside the <code>number-web</code> service which can be accessed in <code>localhost:80</code>, should access the <code>number-generator</code> API to get a random number. I tried to access it using the <code>http://number-generator/</code> and <code>http://number-generator:3000/</code>, but both of them return a network error like this:</p>
<pre><code>GET http://number-generator/ net::ERR_NAME_NOT_RESOLVED
</code></pre>
<p>The error should be more or less the same wether I call <code>http://number-generator/</code> or <code>http://number-generator:3000/</code>. So how can I make this two services talks to each others ?</p>

cantdocpp
<p>I just found the problem.</p>
<p>So, because I use a static site for the frontend, when I call the backend service <strong>it actually calls it from the browser</strong>. The browser is not our kubernetes cluster, so when I tried to access the <strong>number-generator</strong> service using <strong>ajax</strong>, it sends those error.</p>
<p>When I tried to change my static frontend into <strong>express app</strong>, it can access the backend <strong>number-generator</strong> service, because it's included in the cluster.</p>
