<h2>Is it possible to have Knative automatically create K8s Ingress resources?</h2>
<p>Hello all,
Based on the following lines from <a href="https://knative.dev/docs/serving/services/creating-services/" rel="nofollow noreferrer">documentation</a>, I was wondering if I can have Knative automatically create the Ingress resources for my service? I haven't found details on this in the documentation.</p>
<pre><code>After the service has been created, Knative performs the following tasks:

- Creates a new immutable revision for this version of the app.
- Performs network programming to create a route, ingress, service, and load balancer for your app.
- Automatically scales your pods up and down based on traffic, including to zero active pods.
</code></pre>
<p>Example:
Taking the Service and Ingress definition below, would it be possible to abstract away the Ingress yaml and have knative take care of its creation automatically for services?</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: hello
  namespace: knative
spec:
  template:
    metadata:
      labels:
        app: nonprofit
      annotations:
        queue.sidecar.serving.knative.dev/resourcePercentage: &quot;10&quot;
        autoscaling.knative.dev/class: &quot;kpa.autoscaling.knative.dev&quot;
        autoscaling.knative.dev/target: &quot;40&quot;
        autoscaling.knative.dev/min-scale: &quot;1&quot;
        autoscaling.knative.dev/max-scale: &quot;3&quot;
    spec:
      containers:
        - image: gcr.io/knative-samples/helloworld-java
          resources:
            requests:
              cpu: 50m
              memory: 100M
            limits:
              cpu: 200m
              memory: 200M
          ports:
            - containerPort: 8080
          env:
            - name: TARGET
              value: &quot;Sunny Day&quot;
  traffic:
  - tag: latest
    latestRevision: true
    percent: 100
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: knative-hello-ingress
  namespace: knative
  annotations:
    nginx.ingress.kubernetes.io/upstream-vhost: &quot;hello.knative&quot;
spec:
  ingressClassName: &quot;ingress-generic&quot;
  rules:
  - host: &quot;hello-knative.com&quot;
    http:
      paths:
      - pathType: Prefix
        path: &quot;/&quot;
        backend:
          service:
            name: hello
            port:
              number: 80
</code></pre>
<p>Thank you,</p>
<p>Haven't tried anything as I haven't found details in the documentation regarding this.</p>

<p>Unfortunately, the v1 Ingress API in Kubernetes does not have sufficient capabilities to express Knative's routing requirements.  Knative <em>does</em> support several ingress implementations (including Istio, Contour, and the Gateway API), but no one has written a plugin for the Nginx Ingress annotations.</p>
<p>Some of the capabilities that are missing from the Kubernetes Ingress API which are needed by Knative include:</p>
<ul>
<li>Backend traffic splits / weights</li>
<li>Setting request headers to the backend server</li>
<li>Requesting HTTP/2 or websockets protocol support</li>
</ul>
<p>If you're willing to use bets software, the Gateway API plugin is mostly feature complete and should plug into a <a href="https://gateway-api.sigs.k8s.io/implementations/" rel="nofollow noreferrer">variety of ingress providers</a>.  Unfortunately, Nginx does not appear to be on that list.</p>
