Is it possible to have Knative automatically create K8s Ingress resources?
Hello all, Based on the following lines from documentation, 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.
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.
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?
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: "10"
autoscaling.knative.dev/class: "kpa.autoscaling.knative.dev"
autoscaling.knative.dev/target: "40"
autoscaling.knative.dev/min-scale: "1"
autoscaling.knative.dev/max-scale: "3"
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: "Sunny Day"
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: "hello.knative"
spec:
ingressClassName: "ingress-generic"
rules:
- host: "hello-knative.com"
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: hello
port:
number: 80
Thank you,
Haven't tried anything as I haven't found details in the documentation regarding this.