<p>I'm looking into a new update to my kubernetes cluster in Azure. However, I'm not sure how to do this. I have been able to build an ingress controller like this one:</p>
<pre><code>{{- if .Values.ingress.enabled -}}
{{- $fullName := include &quot;test.fullname&quot; . -}}
{{- if and .Values.ingress.className (not (semverCompare &quot;&gt;=1.18-0&quot; .Capabilities.KubeVersion.GitVersion)) }}
  {{- if not (hasKey .Values.ingress.annotations &quot;kubernetes.io/ingress.class&quot;) }}
  {{- $_ := set .Values.ingress.annotations &quot;kubernetes.io/ingress.class&quot; .Values.ingress.className}}
  {{- end }}
{{- end }}
{{- if semverCompare &quot;&gt;=1.19-0&quot; .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare &quot;&gt;=1.14-0&quot; .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
  name: {{ $fullName }}
  labels:
    {{- include &quot;test.labels&quot; . | nindent 4 }}
  {{- with .Values.ingress.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  {{- if and .Values.ingress.className (semverCompare &quot;&gt;=1.18-0&quot; .Capabilities.KubeVersion.GitVersion) }}
  ingressClassName: {{ .Values.ingress.className }}
  {{- end }}
  {{- if .Values.ingress.tls }}
  tls:
    {{- range .Values.ingress.tls }}
    - hosts:
        {{- range .hosts }}
        - {{ . | quote }}
        {{- end }}
      secretName: {{ .secretName }}
    {{- end }}
  {{- end }}
  rules:
    {{- range .Values.ingress.hosts }}
    - host: {{ .host | quote }}
      http:
        paths:
          {{- range .paths }}
          - path: {{ .path }}
            {{- if and .pathType (semverCompare &quot;&gt;=1.18-0&quot; $.Capabilities.KubeVersion.GitVersion) }}
            pathType: {{ .pathType }}
            {{- end }}
            backend:
              {{- if semverCompare &quot;&gt;=1.19-0&quot; $.Capabilities.KubeVersion.GitVersion }}
              service:
                name: {{ $fullName }}
                port:
                  number: {{ .port }}
              {{- else }}
              serviceName: {{ $fullName }}
              servicePort: {{ .port }}
              {{- end }}
          {{- end }}
    {{- end }}
{{- end }}


</code></pre>
<p>My values is the following:</p>
<pre><code>replicaCount: 1
image:
  repository: test01.azurecr.io/test
  tag: update1
  pullPolicy: IfNotPresent
service:
  type: ClusterIP 
  port: 2000
  targetPort: http
  protocol: TCP

ingress:
  enabled: true
  className: &quot;&quot;
  annotations: 
    appgw.ingress.kubernetes.io/use-private-ip: 'true'
    kubernetes.io/ingress.class: azure/application-gateway
  hosts:
    - host: test.com
      paths:
        - path: /test
          pathType: Prefix
          port: 80

  tls: []


serviceAccount:
  # Specifies whether a service account should be created
  create: true
  # Annotations to add to the service account
  annotations: {}
  # The name of the service account to use.
  # If not set and create is true, a name is generated using the fullname template
  name: &quot;&quot;

podAnnotations: {}

podSecurityContext: {}
  # fsGroup: 2000

</code></pre>
<p>My pod is ready and it seems that the service is ready. However, the test.com domain is not working. I added a DNS record for my domain and I used my cluster's IP to make sure the domain will be available. However, I still have an issue to see the domain the error message is the following:</p>
<pre><code>Connection timed out &amp;&amp; This site can’t be reached
</code></pre>
<p>Does anyone knows any better workaround to this?</p>

<p>In Kubernetes you have <a href="https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/" rel="nofollow noreferrer">Ingress Controllers</a> and <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer">Ingress</a> resources. What you have is the definition of an Ingress, not an Ingress Controller. An Ingress will not work unless there is an Ingress Controller installed in your cluster.</p>
<p>However, in AKS (Azure Kubernetes Service), it is possible to bind your Ingress resources to an <a href="https://learn.microsoft.com/en-us/azure/application-gateway/overview" rel="nofollow noreferrer">Azure Application Gateway</a>, which is an Azure resource outside of your cluster.</p>
<p>To achieve this you need <a href="https://learn.microsoft.com/en-us/azure/application-gateway/ingress-controller-overview" rel="nofollow noreferrer">AGIC</a> (Application Gateway Ingress Controller) which will be in charge of forwarding your Ingress configuration to the Application Gateway. You have already achieved this partially by adding these annotations on the Ingress resources you want to have configured there:</p>
<pre><code>annotations: 
  appgw.ingress.kubernetes.io/use-private-ip: 'true'
  kubernetes.io/ingress.class: azure/application-gateway
</code></pre>
<p><strong>Summary</strong>:</p>
<p>You have two options:</p>
<ol>
<li>Install an Ingress Controller such as <a href="https://docs.nginx.com/nginx-ingress-controller/" rel="nofollow noreferrer">nginx</a> or <a href="https://doc.traefik.io/traefik/" rel="nofollow noreferrer">traefik</a> and adapt the annotations on your Ingress resources accordingly.</li>
<li>Make sure you have an Application Gateway deployed in your subscription, AGIC installed in your cluster, and all the configuration needed to allow AGIC to modify the Application Gateway.</li>
</ol>
<p>If it is the first time you are working with Ingresses and Azure, I strongly recommend you follow the first option.</p>
