This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.第 12 章 Networking
12.1. Using Service Mesh with OpenShift Serverless 复制链接链接已复制到粘贴板!
Using Service Mesh with OpenShift Serverless enables developers to configure additional networking and routing options that are not supported when using OpenShift Serverless with the default Kourier implementation. These options include setting custom domains, using TLS certificates, and using JSON Web Token authentication.
Prerequisites
- Install the OpenShift Serverless Operator and Knative Serving.
- Install Red Hat OpenShift Service Mesh.
Procedure
Add the
defaultnamespace to the ServiceMeshMemberRoll as a member:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 重要Adding sidecar injection to Pods in system namespaces such as
knative-servingandknative-serving-ingressis not supported.Create a network policy that permits traffic flow from Knative system pods to Knative services:
Add the
serving.knative.openshift.io/system-namespace=truelabel to theknative-servingnamespace:oc label namespace knative-serving serving.knative.openshift.io/system-namespace=true
$ oc label namespace knative-serving serving.knative.openshift.io/system-namespace=trueCopy to Clipboard Copied! Toggle word wrap Toggle overflow Add the
serving.knative.openshift.io/system-namespace=truelabel to theknative-serving-ingressnamespace:oc label namespace knative-serving-ingress serving.knative.openshift.io/system-namespace=true
$ oc label namespace knative-serving-ingress serving.knative.openshift.io/system-namespace=trueCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy the following
NetworkPolicyresource into a YAML file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Apply the
NetworkPolicyresource:oc apply -f <filename>
$ oc apply -f <filename>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
12.1.1. Enabling sidecar injection for a Knative service 复制链接链接已复制到粘贴板!
You can add an annotation to the Service resource YAML file to enable sidecar injection for a Knative service.
Procedure
Add the
sidecar.istio.io/inject="true"annotation to theServiceresource:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Add the
sidecar.istio.io/inject="true"annotation.
Apply the
Serviceresource YAML file:oc apply -f <filename>
$ oc apply -f <filename>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
12.1.2. Additional resources 复制链接链接已复制到粘贴板!
- For more information about Red Hat OpenShift Service Mesh, see Red Hat OpenShift Service Mesh architecture.