Additional Domain Name For Ingress Controller Azure Kubernetes

12/11/2019

Currently I have an ingress controller that responds to a set of ingress rules . I use this setup as a defacto API gateway that exposes my different services to the internet.

I have an azure domain dev-APIGateway.northeurope.cloudapp.azure.com set to the ingress controller, I set this up via the public ip address via the azure portal

Now to my problem - I want to have an additional domain name that will resolve to the same ingress controller (dev-frontend.northeurope.cloudapp.azure.com) that will satisfy the frontend ingress definition seen below.

I know I can achieve this by creating an additional ingress controller with its own ip address and domain but this seems redundant. See Ingress definitions

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: dev-ingress-someapi
  namespace: dev
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
  - host: dev-APIGateway.northeurope.cloudapp.azure.com
    http:
      paths:
      - backend:
          serviceName: someServiceA-service
          servicePort: 80
        path: /someServiceA/(.*)
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: dev-ingress-frontend
  namespace: dev
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
  - host: dev-frontend.northeurope.cloudapp.azure.com
    http:
      paths:
      - backend:
          serviceName: frontend-service
          servicePort: 80
        path: /

If I had my own domain this would be fine - I wouldy simply add my A name records for the domains that I own along with their CNAMES and point them to ingress controller IP address and that would be it, but this is not the case as im stuck using azure domain names.

-- cl0ud
azure
azure-kubernetes
kubernetes
nginx-ingress

0 Answers