<p>Kubernetes ingress allows us to define rules using ingress resource objects. We have one nginx ingress controller deployed. However for Ingress we have the following needs.</p>
<p>Ingress taking care of external-auth using &quot;auth-url&quot;
TLS termination in Ingress.
Rules for multiple backend services to route.</p>
<p>Is it possible to define an Ingress with only external-auth definition for all routes.
Without specifying the &quot;rule&quot; clause as we plan to maintain dedicated Ingress resource yaml files for routing.</p>
<p>Ex: Ingress1.yaml: Common SSL Termination ingress</p>
<pre><code>resource &quot;kubernetes_ingress&quot; &quot;ssl_terminate_ingress&quot; {
  metadata {
    name = &quot;ssl-termination-ingress&quot;
    namespace = &quot;kube-system&quot;
  }
  spec {
    tls {
      hosts = [&quot;example.com&quot;]
      secret_name = &quot;tls_secret&quot;
    }
  }

  //PLEASE SEE NO RULES AS WE WANT TO DEFINE FOR EVERY APPLICATION IN A SEPARATE FILE
}
</code></pre>
<p>Ingress2.yaml: Common JWT Ingress for all routes</p>
<pre><code>resource &quot;kubernetes_ingress&quot; &quot;jwt_auth_ingress&quot; {
  metadata {
    name = &quot;jwt-auth-ingress&quot; 
    namespace = &quot;kube-system&quot;,
    annotations = {
      &quot;nginx.ingress.kubernetes.io/auth-url&quot; = &quot;http://my-auth-service&quot;
    }
  }

}
</code></pre>
<p>Ingress 3.yaml - Application ingress</p>
<pre><code>resource &quot;kubernetes_ingress&quot; &quot;app_ingress&quot; {
  metadata {
    name = &quot;app-ingress&quot;
    namespace = &quot;app-ns&quot;
  }
  rule {
      host = &quot;example.com&quot;
      http {
        path {
          path = &quot;/my-app&quot;
          backend {
            service_name = &quot;app-service&quot;
            service_port = 80
          }
        }
      }
}
</code></pre>
<p>So we expect Ingress3.yaml to be application ingress and previous two ingress files should be applied before this.</p>
<p>Can we achieve this? Or will it be a single Ingress resource file to be defined where we define all these 3 together for the whole K8s Cluster</p>

Santosh
<p><strong>TL;DR</strong>: Yes you need to keep them together in a single ingress.</p>
<p><strong>Explanation</strong>:</p>
<p>An ingress is a route to your deployed application in simple words.
Having TLS or JWT authentication are &quot;properties&quot; or &quot;additional functionalities&quot; for that route.</p>
<p>In the scenario you presented, you have:</p>
<ul>
<li>ingress1.yaml defining a route to nothing with the property/functionality of TLS termination.</li>
<li>ingress2.yaml is a route to nothing with the property/functionality of JWT authentication.</li>
<li>ingress3.yaml defining a route to your application without any additional properties.</li>
</ul>
<p>You need an ingress which defines the route to your application, with the additional functionality of TLS and JWT authentication. You can achieve this by combining all in one ingress.</p>
