Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

214
Views
Vanilla JS ERR_NAME_NOT_RESOLVED on minikube cluster

I have a minimal web application running on local minikube cluster. The backend is exposing an API at /be/test/hi and service name is also be. When I send a GET request from frontend to backend i get:

main.js:15 GET http://be/be/test/hi net::ERR_NAME_NOT_RESOLVED

If I run nslookup be from the frontend POD i get the correct dns resolution, and running curl be/be/test/hi I get the right response from backend (a simple 'Hello world' string)

What am I missing?

backend.yaml

apiVersion: v1
kind: Service
metadata:
  name: be
spec:
  ports:
    - port: 80
      targetPort: 8080
  selector:
    app: be
  type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: be
spec:
  replicas: 1
  selector:
    matchLabels:
      app: be
  template:
    metadata:
      labels:
        app: be
    spec:
      containers:
      - name: be
        image: kubebe
        imagePullPolicy: Never
        ports:
          - containerPort: 8080

frontend.yaml

apiVersion: v1
kind: Service
metadata:
  name: fe
spec:
  ports:
    - port: 80
      targetPort: 8080
  selector:
    app: fe
  type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: frontend
spec:
  replicas: 1
  selector:
    matchLabels:
      app: fe
  template:
    metadata:
      labels:
        app: fe
    spec:
      containers:
      - name: fe
        image: kubefe
        imagePullPolicy: Never
        ports:
          - containerPort: 8080

main.js

const URL="http://be/be/test/hi"

  function httpGetAsync(){
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.onreadystatechange = function() { 
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
            console.log(xmlHttp.responseText);
    }
    xmlHttp.open("GET", URL, true); 
    xmlHttp.send(null);
}

frontend Dockerfile (kubefe image):

FROM centos/httpd-24-centos7:2.4
RUN mkdir -p /var/www/html/fe
COPY ./index.html ./main.js /var/www/html/fe/

EDIT: I've resolved my issues but I think the actual question is still unanswered.

To solve this I've simple removed the protocol and host from my url and set up proxy rules in /etc/httpd/conf.d/default-site.conf

default-site.conf

<VirtualHost *:8080> 
  ProxyPreserveHost Off
  ProxyRequests Off
  ProxyPass /be/ http://be/be/
</VirtualHost> 
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Your frontend code (javascript) is executing in your browser, not inside the kubernetes cluster (nginx pod)

You have 3 options here,

  1. Create a NodePort Service for your frontend
  2. Rely on kubeproxy for doing a port forward
  3. Create an ingress
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!