Frontend not able to communicate with backend in GKE

enter image description here

I have to service frontend and backend , i created their docker file and push Google Artifact Registry , i deployed both the services in a GKE Cluster

Node Servide.yaml



apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-node-server
spec:
  replicas: 1
  selector:
    matchLabels:
      app: my-node-server
  template:
    metadata:
      labels:
        app: my-node-server
    spec:
      containers:
      - name: my-node-server
        image: us-central1-docker.pkg.dev/ycxz-426410/ycxz/backend:latest
        ports:
        - containerPort: 5000

---

apiVersion: v1
kind: Service
metadata:
  name: my-node-server-service
spec:
  selector:
    app: my-node-server
  ports:
    - protocol: TCP
      port: 80
      targetPort: 5000
  type: ClusterIP 

Frontend.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-react-server
spec:
  replicas: 1
  selector:
    matchLabels:
      app: my-react-server
  template:
    metadata:
      labels:
        app: my-react-server
    spec:
      containers:
      - name: my-react-server
        image: us-central1-docker.pkg.dev/ycxz-426410/ycxz/frontend:latest
        ports:
        - containerPort: 3000
        env:
          - name: REACT_APP_URL
            value: "http://my-node-server-service.default.svc.cluster.local"

---

apiVersion: v1
kind: Service
metadata:
  name: my-react-server-service
spec:
  selector:
    app: my-react-server
  ports:
    - protocol: TCP
      port: 80
      targetPort: 3000
  type: ClusterIP

and my ingress.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: my-ingress
spec:
  rules:
    - http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: my-react-server-service
                port:
                  number: 80
          
  ingressClassName: nginx 

after apllying these file my react server got up and access it using ingress external ip
but it showing error that it not able communicate with backend

Backend URL: http://my-node-server-service.default.svc.cluster.local
App.js:23 Backend URL: http://my-node-server-service.default.svc.cluster.local
App.js:15 Fetching message...
App.js:15 Fetching message...
App.js:20 Error fetching message: AxiosError {message: 'Network Error', name: 'AxiosError', code: 'ERR_NETWORK', config: {…}, request: XMLHttpRequest, …}
fetchMessage @ App.js:20
await in fetchMessage (async)
(anonymous) @ App.js:10
commitHookEffectListMount @ react-dom.development.js:23189
commitPassiveMountOnFiber @ react-dom.development.js:24965
commitPassiveMountEffects_complete @ react-dom.development.js:24930
commitPassiveMountEffects_begin @ react-dom.development.js:24917
commitPassiveMountEffects @ react-dom.development.js:24905
flushPassiveEffectsImpl @ react-dom.development.js:27078
flushPassiveEffects @ react-dom.development.js:27023
(anonymous) @ react-dom.development.js:26808
workLoop @ scheduler.development.js:266
flushWork @ scheduler.development.js:239
performWorkUntilDeadline @ scheduler.development.js:533
Show 11 more frames
Show lessUnderstand this error
App.js:16 
        
        
 GET http://my-node-server-service.default.svc.cluster.local/api/hello net::ERR_NAME_NOT_RESOLVED


how to dynamically make communication betwwen frontend and backend

when i login to Kubernetes pod and try to to

curl http://my-node-server-service.default.svc.cluster.local/api/hello

it working but the outside cluster is not able to access

New contributor

Amllan Bhukta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật