第 3 章 在与 OpenShift Service Mesh 3 相同的集群中运行 OpenShift Service Mesh 2.6
如果您要从 Red Hat OpenShift Service Mesh v2.6 进行迁移,您可以与 OpenShift Service Mesh v3.0 并行运行 OpenShift Service Mesh v2.6,而无需相互干扰。
3.1. 使用多租户部署模型运行 OpenShift Service Mesh 2.6 和 OpenShift Service Mesh 3
如果您要从默认的多租户部署模型从 Red Hat OpenShift Service Mesh 2.6 进行迁移,您可以在一个集群中使用 OpenShift Service Mesh 2.6 并行运行 OpenShift Service Mesh 2.6 侧,而无需相互干扰。
在 OpenShift Service Mesh 2.6 中,您可以在 spec.mode
下从 ServiceMeshControlPlane
检查部署模型:
ServiceMeshControlPlane
yaml 示例
apiVersion: maistra.io/v2 kind: ServiceMeshControlPlane metadata: name: basic spec: mode: MultiTenant
先决条件
- 运行 OpenShift Container Platform 4.14 或更高版本。
运行 OpenShift Service Mesh 2.6。
重要如果没有运行 OpenShift Service Mesh 2.6,您必须按照以下步骤升级到 2.6。要升级到 OpenShift Service Mesh 版本到 2.6,请参阅升级 Service Mesh 2.x
流程
- 安装 OpenShift Service Mesh 3 Operator。
-
在
istio-cni
命名空间中创建IstioCNI
资源。 在与 OpenShift Service Mesh 2.6 中
ServiceMeshControlPlane
资源中使用的命名空间不同的命名空间中创建Istio
资源。这个示例使用istio-system3
命名空间:带有
istio-system3
的Istio
资源示例kind: Istio piVersion: sailoperator.io/v1alpha1 metadata: name: ossm3 1 spec: namespace: istio-system3 2 values: meshConfig: discoverySelectors: 3 - matchExpressions: - key: maistra.io/member-of operator: DoesNotExist updateStrategy: type: InPlace version: v1.23.0
运行以下命令,部署工作负载并使用
istio.io/rev=ossm3
标签标记命名空间:$ oc label namespace <namespace-name> istio.io/rev=<revision-name>
注意如果您在 OpenShift Service Mesh 2.6 中的
ServiceMeshControlPlane
资源中更改了ServiceMeshMemberRoll
中的spec.memberSelectors
,请为 OpenShift Service Mesh 3.0 工作负载命名空间使用istio-injection=enabled
标签。运行以下命令,确认应用程序工作负载由其对应的 control plane 管理:
$ istioctl ps -i istio-system
istio-system
输出示例$ istioctl ps -i istio-system NAME CLUSTER CDS LDS EDS RDS ECDS ISTIOD VERSION details-v1-7f46897b-88x4l.info Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-install-istio-system-bd58bdcd5-2htkf 1.20.8 mongodb-v1-6cf7dc9885-7nlmq.info Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-install-istio-system-bd58bdcd5-2htkf 1.20.8 mysqldb-v1-7c4c44b9b4-22b57.info Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-install-istio-system-bd58bdcd5-2htkf 1.20.8 productpage-v1-6f9c6589cb-l6rvg.info Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-install-istio-system-bd58bdcd5-2htkf 1.20.8 ratings-v1-559b64556-f6b4l.info Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-install-istio-system-bd58bdcd5-2htkf 1.20.8 ratings-v2-8ddc4d65c-bztrg.info Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-install-istio-system-bd58bdcd5-2htkf 1.20.8 ratings-v2-mysql-cbc957476-m5j7w.info Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-install-istio-system-bd58bdcd5-2htkf 1.20.8 reviews-v1-847fb7c54d-7dwt7.info Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-install-istio-system-bd58bdcd5-2htkf 1.20.8 reviews-v2-5c7ff5b77b-5bpc4.info Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-install-istio-system-bd58bdcd5-2htkf 1.20.8 reviews-v3-5c5d764c9b-mk8vn.info Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-install-istio-system-bd58bdcd5-2htkf 1.20.8
输出
istio-system3
示例$ istioctl ps -i istio-system3 NAME CLUSTER CDS LDS EDS RDS ECDS ISTIOD VERSION details-v1-57f6466bdc-5krth.info2 Kubernetes SYNCED (2m40s) SYNCED (2m40s) SYNCED (2m34s) SYNCED (2m40s) IGNORED istiod-ossm3-5b46b6b8cb-gbjx6 1.23.0 productpage-v1-5b84ccdddf-f8d9t.info2 Kubernetes SYNCED (2m39s) SYNCED (2m39s) SYNCED (2m34s) SYNCED (2m39s) IGNORED istiod-ossm3-5b46b6b8cb-gbjx6 1.23.0 ratings-v1-fb764cb99-kx2dr.info2 Kubernetes SYNCED (2m40s) SYNCED (2m40s) SYNCED (2m34s) SYNCED (2m40s) IGNORED istiod-ossm3-5b46b6b8cb-gbjx6 1.23.0 reviews-v1-8bd5549cf-xqqmd.info2 Kubernetes SYNCED (2m40s) SYNCED (2m40s) SYNCED (2m34s) SYNCED (2m40s) IGNORED istiod-ossm3-5b46b6b8cb-gbjx6 1.23.0 reviews-v2-7f7cc8bf5c-5rvln.info2 Kubernetes SYNCED (2m40s) SYNCED (2m40s) SYNCED (2m34s) SYNCED (2m40s) IGNORED istiod-ossm3-5b46b6b8cb-gbjx6 1.23.0 reviews-v3-84f674b88c-ftcqg.info2 Kubernetes SYNCED (2m40s) SYNCED (2m40s) SYNCED (2m34s) SYNCED (2m40s) IGNORED istiod-ossm3-5b46b6b8cb-gbjx6 1.23.0