Azure Kubernetes not working after ingress upgarde

M T, ABHISHEK 20 Reputation points
2023-03-24T03:46:47.61+00:00

We are currently using AKS version 1.20.7, and our application is running fine. As per the document ingress v1 is supported starting from 1.19. So we tried updating ingress form v1beta1 to v1, now suddenly we are receiving 502 bad gateway error. Things were working fine before the upgrade, the only change that we did is upgrading ingress to v1 (and associated syntax change). What could be the reason?

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.
2,447 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Andrei Barbu 2,596 Reputation points Microsoft Employee
    2023-03-24T06:41:18.3166667+00:00

    Hello M T, ABHISHEK

    As per https://kubernetes.io/docs/reference/using-api/deprecation-guide/#ingressclass-v122, you are right, networking.k8s.io/v1 was introduced in 1.19 and no longer served as of 1.22

    Beside the new API version, there are some changes in the fields. In the networking.k8s.io/v1beta1 version, the serviceName and servicePort fields are used to specify the backend service, while in the networking.k8s.io/v1 version, the service field is used, which includes the service name and port. Additionally, in the networking.k8s.io/v1 version, the pathType field is used to specify the type of path matching, which can be Prefix, Exact, or ImplementationSpecific.

    Here's an example of an Ingress resource using the networking.k8s.io/v1beta1 API:

    apiVersion: networking.k8s.io/v1beta1
    kind: Ingress
    metadata:
      name: example-ingress
    spec:
      rules:
      - host: example.com
        http:
          paths:
          - path: /
            backend:
              serviceName: example-service
              servicePort: 80
    

    Here's an example of the same Ingress resource using the networking.k8s.io/v1 API:

    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: example-ingress
    spec:
      rules:
      - host: example.com
        http:
          paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: example-service
                port:
                  name: http
    

    You may want to take a look at these fields and make sure they are set correctly after the change you performed.

    Additionally, please note Kubernetes version 1.20 is no longer support in AKS for a long period. As per https://learn.microsoft.com/en-us/azure/aks/supported-kubernetes-versions?tabs=azure-cli#what-does-outside-of-support-mean, "AKS doesn't make any runtime or other guarantees for clusters outside of the supported versions list."

    I would suggest you upgrade to a support Kubernetes version.


    I hope this is helpful. If any clarification needed, let me know and I will do my best to answer.

    Please "Accept as Answer" and Upvote if it helped, so that it can help others in the community looking for help on similar topics.

    Thank you!

    0 comments No comments

  2. vipullag-MSFT 26,487 Reputation points Moderator
    2023-03-29T10:20:55.7933333+00:00

    Hello M T, ABHISHEK

    Welcome to Microsoft Q&A Platform, thanks for posting your query here.

    Here are some things you can check:

    -Make sure that the version of the ingress controller you are using is compatible with the ingress v1 syntax. Check the documentation and release notes of your ingress controller to ensure that you are using the correct version.

    -The ingress resource syntax has changed from v1beta1 to v1. Ensure that you have updated the ingress resource with the correct syntax changes. Check the Kubernetes documentation and the documentation of your ingress controller for any syntax changes required.

    -Check the ingress controller configuration and make sure that all the required configurations are set correctly. If there are any issues, fix them, and restart the ingress controller.

    -Check if the service associated with the ingress is running correctly. Ensure that the service is exposed correctly and has the correct ports and endpoints.

    -Check the networking configuration of your Kubernetes cluster. Ensure that the network policies are correctly configured, and there are no network conflicts that are causing the 502 error. Make sure that the networking configuration is correct. Check if the Ingress controller and the Service are in the same network namespace.

    kubectl get pod <ingress-controller-pod-name> -n <ingress-namespace> -o yaml | grep hostNetwork

    If the hostNetwork option is set to true, it means that the Ingress controller is using the host network, and you need to make sure that the Service is also using the host network.

    -Make sure that the DNS configuration is correct. Check if the domain name is correctly configured and resolving to the correct IP address.

    nslookup <domain-name>

    If the domain name is not resolving to the correct IP address, you need to check the DNS configuration.

    -Use the logs of the ingress controller and the pods associated with the service to identify the root cause of the issue. Look for any error messages that could provide clues about what went wrong.

    Overall, upgrading to ingress v1 should not cause any issues, as it is supported in AKS 1.20.7. However, there could be some configuration issues or syntax changes that need to be addressed.

    Hope this helps.

    0 comments No comments

Your answer

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