I am trying to use GCE ingress to send external traffic to my frontend and backend services deployed to GKE using a global static ip. This is part of my test project hence there is no use of dns and all. So my target is simple, i.e.,
curl "ingress-ip" # should send traffic to my frontend service
curl "ingress-ip/api/" # should send the traffic to my backend api service
When I tested with LoadBalancer service type (in service.yaml instead of NodePort) it worked well for the backend and frontend services, but I want to have one single ip for both my backend and frontend and with the following helm chart yaml it does not seems to be working.
After the ingress is deployed it took some time to get into ‘OK’ state, but when I am hitting my frontend, only the app title is fetched, rest the body of the webpage is blank. And in case of backend service I’m getting 404. I waited at least 15mins between ingress provisioning and hitting the url from my browser.
Any help would be appreciated.
ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Values.ingress.name }}
annotations:
kubernetes.io/ingress.class: gce
kubernetes.io/ingress.global-static-ip-name: {{ .Values.ingress.gke_static_ip }}
spec:
rules:
- http:
paths:
- path: /*
pathType: ImplementationSpecific
backend:
service:
name: {{ .Values.frontend.name }}
port:
number: {{ .Values.frontend.port }}
- path: /api/bpcalc/*
pathType: ImplementationSpecific
backend:
service:
name: {{ .Values.backend.name }}
port:
number: {{ .Values.backend.port }}
service.yaml (both the services have similar config)
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.container.name }}-service
spec:
type: NodePort
selector:
repo: bpcalc
ports:
- protocol: TCP
port: 80
targetPort: {{ .Values.container.port }}
