Switch to another Kubernetes Gateway
You can switch to any gateway implementations that support Kubernetes Gateway API such as Contour, Istio, Apache APISIX, Envoy Gateway (in the future) and more in an easier and vendor-neutral way.
For example, you can choose to use Istio as the underlying Kubernetes Gateway
like this:
- Install OpenFunction without
Contour
:
helm install openfunction --set global.Contour.enabled=false openfunction/openfunction -n openfunction
- Install
Istio
and then enable its Knative integration:
kubectl apply -l knative.dev/crd-install=true -f https://github.com/knative/net-istio/releases/download/knative-v1.3.0/istio.yaml
kubectl apply -f https://github.com/knative/net-istio/releases/download/knative-v1.3.0/istio.yaml
kubectl apply -f https://github.com/knative/net-istio/releases/download/knative-v1.3.0/net-istio.yaml
- Create a
GatewayClass
namedistio
:
kubectl apply -f - <<EOF
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: GatewayClass
metadata:
name: istio
spec:
controllerName: istio.io/gateway-controller
description: The default Istio GatewayClass
EOF
- Create an
OpenFunction Gateway
:
kubectl apply -f - <<EOF
apiVersion: networking.openfunction.io/v1alpha1
kind: Gateway
metadata:
name: custom-gateway
namespace: openfunction
spec:
domain: ofn.io
clusterDomain: cluster.local
hostTemplate: "{{.Name}}.{{.Namespace}}.{{.Domain}}"
pathTemplate: "{{.Namespace}}/{{.Name}}"
gatewayDef:
namespace: openfunction
gatewayClassName: istio
gatewaySpec:
listeners:
- name: ofn-http-external
protocol: HTTP
port: 80
allowedRoutes:
namespaces:
from: All
EOF
- Reference the custom
OpenFunction Gateway
(Istio) in thegatewayRef
field of aFunction
:
kubectl apply -f - <<EOF
apiVersion: core.openfunction.io/v1beta1
kind: Function
metadata:
name: function-sample
spec:
version: "v1.0.0"
image: "openfunctiondev/v1beta1-http:latest"
port: 8080
serving:
runtime: knative
template:
containers:
- name: function
imagePullPolicy: Always
route:
gatewayRef:
name: custom-gateway
namespace: openfunction
EOF
当前内容版权归 OpenFunction 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 OpenFunction .