-
I'm pretty confused about routing traffic to a function. I just don't understand what's going on here. I want to manage routing using the Gateway API and HttpRoute resources, just like I do with standard k8s Service resources for microservices. Is that possible? So, given an existing Gateway (running Istio, btw), I'd like to add the following apiVersion: v1
kind: Namespace
metadata:
name: ingress
---
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: gateway
namespace: ingress
spec:
gatewayClassName: istio
listeners:
- name: http-listener
port: 80
protocol: HTTP
allowedRoutes:
namespaces:
from: All
- name: https-listener
port: 443
protocol: TLS
tls:
mode: Passthrough
allowedRoutes:
namespaces:
from: All Then the apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: kn-hello-route
namespace: saas-app
spec:
parentRefs:
- group: gateway.networking.k8s.io
kind: Gateway
name: gateway
namespace: ingress
rules:
- backendRefs:
- group: ""
kind: Service
name: kn-hello-service
namespace: saas-app
port: 80
weight: 1
matches:
- path:
type: PathPrefix
value: /
filters:
- type: URLRewrite
urlRewrite:
path:
type: ReplacePrefixMatch
replacePrefixMatch: /api/v1/hello Assuming the following Knative Service: apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: kn-hello-service
namespace: saas-app
spec:
template:
spec:
containers:
- image: ghcr.io/knative/helloworld-go:latest
ports:
- containerPort: 8080
env:
- name: TARGET
value: "World" Is that possible? It's confusing, because according to the docs Knative Ingress creates subdomains for functions. kn service create hello \
--image ghcr.io/knative/helloworld-go:latest \
--port 8080 \
--env TARGET=World Which would be accessed via If using the operator for managing Serving, would the following be correct? apiVersion: v1
kind: Namespace
metadata:
name: knative-serving
---
apiVersion: operator.knative.dev/v1beta1
kind: KnativeServing
metadata:
name: knative-serving
namespace: knative-serving
spec:
ingress:
istio:
enabled: true
knative-ingress-gateway:
selector:
istio: ingressgateway
config:
istio:
external-gateways: |
- name: gateway
namespace: ingress
service: gateway-istio.ingress.svc.cluster.local |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I believe this was answered in slack here - https://cloud-native.slack.com/archives/C04LMU0AX60/p1736451011275479 |
Beta Was this translation helpful? Give feedback.
I believe this was answered in slack here - https://cloud-native.slack.com/archives/C04LMU0AX60/p1736451011275479