I enabled AGIC in the Azure portal and then created Fanout Ingress. But it's not working. I checked Rules (ingress-appgateway > Rules > Path-based routing) and paths are targeting correct backend pool.
When I am testing health probe, it's failing ("MC_..." resource group > ingress-appgateway > Health probes > Click test) - showing error :
One or more of your backend instances are unhealthy. It is recommended to address this health issue first before attaching the probe
I tried:
- disabling and enabling AGIC -> did not work
- using
pathType: ImplementationSpecific(instead ofpathType: Prefix) -> did not work nginx.ingress.kubernetes.io/rewrite-target: /$1&/foo(/|$)(.*)-> did not work
At the top of the Overview page of "ingress-appgateway" (Azure portal), showing error:
All the instances in one or more of your backend pools are unhealthy. This will result in a 502 error when you try to access your application hosted behind the Application Gateway. Please check the backend health and resolve the issue.
It works only If I remove paths (/foo & /bar) and target a single service.
FYI, I am using Azure CNI networking and existing VNet (dedicated subnet).
deployment.yaml
apiVersion: v1
kind: Service
metadata:
name: demo-web-app1
namespace: demo
spec:
selector:
app: demo-web-app1
type: ClusterIP
ports:
- protocol: TCP
port: 4200
targetPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: demo-web-app2
namespace: demo
spec:
selector:
app: demo-web-app2
type: ClusterIP
ports:
- protocol: TCP
port: 8080
targetPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo-web-app1
namespace: demo
spec:
replicas: 2
selector:
matchLabels:
app: demo-web-app1
template:
metadata:
labels:
app: demo-web-app1
spec:
containers:
- name: demo-web-app1
image: myacr.azurecr.io/myacr6472:375
ports:
- containerPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo-web-app2
namespace: demo
spec:
replicas: 3
selector:
matchLabels:
app: demo-web-app2
template:
metadata:
labels:
app: demo-web-app2
spec:
containers:
- name: demo-web-app2
image: myacr.azurecr.io/myacr6472:375
ports:
- containerPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-demo-web-app
namespace: demo
annotations:
kubernetes.io/ingress.class: azure/application-gateway
appgw.ingress.kubernetes.io/ssl-redirect: "false"
spec:
rules:
- http:
paths:
- path: /foo
pathType: Prefix
backend:
service:
name: demo-web-app1
port:
number: 4200
- path: /bar
pathType: Prefix
backend:
service:
name: demo-web-app2
port:
number: 8080