I had configured an azure application gateway with ingress controller and everything looks good i.e
- Workload is running
- Service is running
- Ingress resource deployed
below is the image of 'Backed health'

Service status

Ingress status

Pods status

Below the are yaml snippets used for pods, ingress, service deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: apiservice-deployment
labels:
app: apiservice
spec:
replicas: 1
selector:
matchLabels:
app: apiservice
template:
metadata:
labels:
app: apiservice
spec:
containers:
- name: apiservice
image: "{{ .Values.image.repository }}:{{ .Values.image.tag}}"
ports:
- containerPort: 8080
protocol: TCP
apiVersion: v1
kind: Service
metadata:
name: apiservice-service
spec:
ports:
- port: 80
targetPort: 8080
protocol: TCP
name: http
selector:
app: apiservice
type: ClusterIP
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: apiservice-ingress
annotations:
kubernetes.io/ingress.class: azure/application-gateway
spec:
rules:
- http:
paths:
- path: /
backend:
service:
name: apiservice-service
port:
number: 80
pathType: Prefix
Pods, service and ingress showing as green status but Gateways says 'All the instances in one or more backend pool is unhealthy', I can see the below is the backend pool

I am not able to figure our why I am getting the error "502 Bad Gateway" when I am trying to access the app via the public IP "http://20.85.243.181/",
Kindly suggest if I am doing something wrong