Application Gateway ingress controller not working

William A Wang 251 Reputation points
2022-02-28T07:23:27.327+00:00

I using AKS to host some backend apps, these apps are based on asp .net 6.0 containers, and use 80 port to communicate.
I created a ingress which point the host to service and the service related to deployment. And the DNS zone is related the host to the frontend ip address of appgw.
When I using the browser to access the webapi page the status is timed out. and the backend health of appgw show the status is unhealthy with message:

Received invalid status code: 404 in the backend server’s HTTP response. As per the health probe configuration, 200-399 is the acceptable status code. Either modify probe configuration or resolve backend issues. To learn more visit - https://aka.ms/StatusCodeMismatch.  

But if I use VPN to connect to the virtual network and use the pod's ip address to access it and it is succeed.
Weird, right?

178384-1.png

178328-2.png

The ingress yaml:
kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: ingressxxxxapi
namespace: default
uid: fc1bd1e4-1da9-43b9-add2-d5ba4bc0ad22
resourceVersion: '16194356'
generation: 2
creationTimestamp: '2022-02-28T06:34:15Z'
annotations:
kubernetes.io/ingress.class: azure/application-gateway
managedFields:
- manager: Mozilla
operation: Update
apiVersion: networking.k8s.io/v1
time: '2022-02-28T06:34:15Z'
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:annotations:
.: {}
f:kubernetes.io/ingress.class: {}
f:spec:
f:rules: {}
- manager: appgw-ingress
operation: Update
apiVersion: extensions/v1beta1
time: '2022-02-28T06:34:16Z'
fieldsType: FieldsV1
fieldsV1:
f:status:
f:loadBalancer:
f:ingress: {}
spec:
rules:
- host: api.xxxx.biz
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: xxxxerapi
port:
number: 80
status:
loadBalancer:
ingress:
- ip: 20.24.x.x

Azure Application Gateway
Azure Application Gateway
An Azure service that provides a platform-managed, scalable, and highly available application delivery controller as a service.
Azure Kubernetes Service
Azure Kubernetes Service
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Manu Philip 20,491 Reputation points MVP Volunteer Moderator
    2022-02-28T08:04:32.943+00:00

    I think, you need to define backend like below under spec: The error message indicates the same message

    spec:
      backend:
        serviceName: appname
        servicePort: 80
    

    If the Answer is helpful, please click "Accept Answer" and upvote it


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.