Reputation: 1
I configured application gateway ingress controller for my Kubernetes cluster, but I can't access my pod container app named myapp running on port 8080/TCP.
I created a service that has the following configuration:
apiVersion: v1
kind: Service
metadata:
name: myapp-service
spec:
selector:
app: myapp
ports:
- port: 8080
name: myapp-api
and the ingress with the following configuration:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-resource
annotations:
kubernetes.io/ingress.class: azure/application-gateway
spec:
rules:
- http:
paths:
- backend:
service:
name: myapp-service
port:
number: 8080
path: /
pathType: Exact
but still every time I access the fronted IP of the application gateway, I get 502 Bad Gateway? Am I missing something?
Upvotes: 0
Views: 1089
Reputation: 4786
Glad @Razvan that you resolved the issue yourself. Posting your resolution as an answer to help other community members.
There can be many reasons for App Gateway 502 errors mainly if the backend health shows as unhealthy in Application Gateway.
That you resolved using the correct annotation which in turn returned the 404 Error. It is resolved by adding the following annotation to the ingress:
appgw.ingress.kubernetes.io/health-probe-status-codes: "200 -399, 404 "
After adding the health probes, the backend service will become healthy.
There is a similar issue on Microsoft Q&A, where the 502 Bad Gateway error on Azure Applicate Gateway Ingress is solved by Ingress Annotations as well as the Probes Path correctly and also few reasons mentioned here which causes this error.
Upvotes: 0