Sorry for the delay in response.
- A 502 Connection Refused error usually means that the Load Balancer can't connect to the backend. As you mentioned the service is waiting on port 8080 on AKS cluster, please verify that the Kubernetes Service object is correctly configured to target the right Pods and that it is using the 8080 port.
- Make sure that the Service type is set to Load Balancer in AKS. For your reference: https://learn.microsoft.com/en-us/troubleshoot/azure/azure-kubernetes/connectivity/connection-issues-application-hosted-aks-cluster#access-the-loadbalancer-service
- Please verify status of the pods running in your AKS cluster and make sure that there are running. For your reference: https://learn.microsoft.com/en-us/troubleshoot/azure/azure-kubernetes/connectivity/connection-issues-application-hosted-aks-cluster#step-1-check-whether-the-pod-is-running-and-the-app-or-container-inside-the-pod-is-responding-correctly
- As you mentioned the port 8080 is open on the NSG, it's important to verify that the NSG rules are set to permit inbound traffic specifically from the Load Balancer. Additionally, ensure there are no conflicting rules for inbound or outbound traffic that might be causing interruptions.
- Ensure that the NSG is correctly linked to the appropriate subnet or network interface designated for the AKS nodes. For your reference: https://learn.microsoft.com/en-us/azure/virtual-network/tutorial-filter-network-traffic?tabs=portal#associate-network-security-group-to-subnet
- As you mentioned that the health probe is operational, please make sure that it's set up to monitor the correct path and port. It's possible that the path defined for the health probe might be unreachable or may not yield a successful status.
- Ensure you review the Load Balancer settings in the Azure portal. It's important to verify that both the frontend IP configuration and the backend pool are correctly established. Also, confirm that the health probe is properly linked to the appropriate backend pool, also verify the other configuration in load balancer. For your reference: https://learn.microsoft.com/en-us/azure/load-balancer/load-balancer-troubleshoot
Kindly let us know if the above helps or you need further assistance on this issue.
If above is unclear and/or you are unsure about something add a comment below.
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.
Thanks,
Sai Prasanna.