<p>I am new for kubernetes and Have an issue for ingress nginx for external domain from godaddy. it is called &quot; <a href="https://uat.test.com" rel="nofollow noreferrer">https://uat.test.com</a> &quot; .I created some yaml for nginx-ingress but I couldn't do that. How can I add &quot;uat.test.com &quot; to my kubernetes cluster by using nginx-ingress?</p>
<p>Below ; They are my steps for my funny and stressful advantures.</p>
<ol>
<li>Create group and namespace :</li>
</ol>
<pre><code>az group create --name aks-group --location eastus2

az aks create --resource-group aks-group --name aks-cluster --node-count 3 --generate-ssh-keys -s Standard_B2ms --disable-rbac

kubectl create namespace ingress-basic
</code></pre>
<ol start="2">
<li>Credentials:</li>
</ol>
<pre><code>az aks get-credentials -g aks-group -n aks-cluster

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.43.0/deploy/static/provider/cloud/deploy.yaml
 
az aks get-credentials -g aks-group -n aks-cluster

kubectl --namespace ingress-basic get services -o wide -w nginx-ingress-ingress-nginx-controller
</code></pre>
<ol start="3">
<li>install ingress-nginx:</li>
</ol>
<pre><code>helm install ingress-nginx ingress-nginx/ingress-nginx
   
helm repo update
    
helm install nginx-ingress ingress-nginx/ingress-nginx --namespace ingress-basic --set controller.replicaCount=2
     
kubectl --namespace ingress-basic get services -o wide -w nginx-ingress-ingress-nginx-control

</code></pre>
<p><a href="https://i.stack.imgur.com/Cj5I7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Cj5I7.png" alt="enter image description here" /></a>
aks-helloworld-one.yaml :</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: aks-helloworld-one  
spec:
  replicas: 1
  selector:
    matchLabels:
      app: aks-helloworld-one
  template:
    metadata:
      labels:
        app: aks-helloworld-one
    spec:
      containers:
      - name: aks-helloworld-one
        image: mcr.microsoft.com/azuredocs/aks-helloworld:v1
        ports:
        - containerPort: 80
        env:
        - name: TITLE
          value: &quot;Welcome to Azure Kubernetes Service (AKS)&quot;
---
apiVersion: v1
kind: Service
metadata:
  name: aks-helloworld-one  
spec:
  type: ClusterIP
  ports:
  - port: 80
  selector:
    app: aks-helloworld-one
</code></pre>
<pre><code>kubectl apply -f aks-helloworld-one.yaml --namespace ingress-basic
</code></pre>
<p>aks-helloworld-two.yml:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: aks-helloworld-two  
spec:
  replicas: 1
  selector:
    matchLabels:
      app: aks-helloworld-two
  template:
    metadata:
      labels:
        app: aks-helloworld-two
    spec:
      containers:
      - name: aks-helloworld-two
        image: mcr.microsoft.com/azuredocs/aks-helloworld:v1
        ports:
        - containerPort: 80
        env:
        - name: TITLE
          value: &quot;AKS Ingress Demo&quot;
---
apiVersion: v1
kind: Service
metadata:
  name: aks-helloworld-two  
spec:
  type: ClusterIP
  ports:
  - port: 80
  selector:
    app: aks-helloworld-two
</code></pre>
<pre><code>kubectl apply -f aks-helloworld-two.yaml --namespace ingress-basic

</code></pre>
<p>hello-world-ingress.yml:</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: hello-world-ingress
  namespace: ingress-basic
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/ssl-redirect: &quot;false&quot;
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
  - host: uat.test.com 
    http:
      paths:
      - backend:
          serviceName: aks-helloworld-one
          servicePort: 80
        path: /hello-world-one(/|$)(.*)
      - backend:
          serviceName: aks-helloworld-two
          servicePort: 80
        path: /hello-world-two(/|$)(.*)
      - backend:
          serviceName: aks-helloworld-one
          servicePort: 80
        path: /(.*)
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: hello-world-ingress-static
  namespace: ingress-basic
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/ssl-redirect: &quot;false&quot;
    nginx.ingress.kubernetes.io/rewrite-target: /static/$2
spec:
  rules:
  - http:
      paths:
      - backend:
          serviceName: aks-helloworld-one
          servicePort: 80
        path: /static(/|$)(.*)
</code></pre>
<pre><code>kubectl apply -f hello-world-ingress.yaml
</code></pre>
<p>When I write address &quot;https://uat.test.com &quot;</p>
<p>Result or Error:
<a href="https://i.stack.imgur.com/QsLJY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QsLJY.png" alt="enter image description here" /></a></p>

Penguen
<p>// as discussed in the comments</p>
<p>somewhere you need to bind the public IP address of your clusters ingress controller to your DNS name. That does not happen in AKS (or anywhere in your k8s configs). You need to do that with your DNS provider.</p>
