How to deploy cluster pod to custom domain name

Vainqueur Mahirwe 0 Reputation points
2023-08-11T13:59:41.17+00:00

I have a kubernetes manifest file that I'm deploying in a kubernetes cluster on Azure. The file defines a namespace, a service for the db, a service for the server, a service for the client/frontend, an ingress service that maps the client/frontend service to the custom domain (demo.lightblue.co.za), and deployments for the db, server, and client. When the ingress service is defined as highlighted below (ingress 1 first approach), no public ip address is provided. However, when the same ingress is redefined (second approach) using addon-http-application-routing, an ip address is assigned next to the specified domain name. That said, visiting the domain name only displays the reserved for <CUSTOM_DOMAIN_NAME page instead of loading the app deployed by the client/frontend service. Moreover, clicking on the ip address provided by the ingress service also loads a page with a ``404 Not found nginxpage. I can confirm that all pods run successfully and you can also load the client through port-forwarding without any issues. Issues start when you want to run the same pod over a secure connection (i.e., https). How do I resolve this issue?

  • Client service:
  • client service
  • Client Deployment:
  • client deployment
  • Ingress service (First approach) ingress first approach
  • Ingress service in azure portal (First approach)

ingress in portal (2)

  • Ingress service (Second approach) ingress definition 2 (4)
  • Ingress service in azure portal (Second approach) ingress in portal second (5)
  • Networking settings: Networking settings
  • addon-http-application-routing: addon
  • 404 not found error 404 error

Visiting custom domain

Reserved custom domain (3)

  • I also tried creating a DNS A record using the following command; still didn't resolve the issue. ``
az network dns record-set a add-record \
    --resource-group myResourceGroup \
    --zone-name demo.lightblue.co.za \
    --record-set-name "*" \
    --ipv4-address <STATIC_IP_ADDRESS_TO_APPEAR_IN_INGRESS_SERVICE>

`

Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,377 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. mutaz-msft 2,351 Reputation points Microsoft Employee
    2023-08-14T09:02:29.9+00:00

    Hi Vainqueur Mahirwe,

    In your setup you are using 3 types of ingress ( HTTP application routing add-on, AGIC addon , and the native unmanaged Ingress controller in one of the ingress YAML files).

    Better to decide which one do want to use since there will be an annotation in ingress route YAML to decide which one should be used.

    This annotation for HTTP app routing addon:

      annotations:
        kubernetes.io/ingress.class: addon-http-application-routing
    

    This annotation for AGIC addon:

      annotations:
        kubernetes.io/ingress.class: azure/application-gateway
    

    and for native unmagaed, we don't use annotation but we use the ingressclass ( kubectl get ingressclass) and the default value will be ingress:

    spec:
      ingressClassName: nginx
    

    For your installation, use of of these ways and create the ingress route based on the selected way as in the links which I shared above.
    Keep in mind the following:

    1. If you added a host in the ingress route YAML then you should not access the ingress IP since the routing will be based host name not IP. ( you will get 404 if you access the IP direclty)
    2. If you used a public host name then the ingress IP address should be added to the global DNS for your domain to be able to access your domain publicly.
    3. If your domain is local and you need to test then you add it it to the hosts file on your machine or use this command: curl -H 'Host:domain-name.com' https://IPaddress/pathIfExists -k

    Hope this helps, and please "Accept as Answer" if it helped, so that it can help others in the community looking for help on similar topics.


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.