Chapter 3. Multitenant migration guide
3.1. Multitenant migration guide Copy linkLink copied to clipboard!
This guide is for users who are currently running a multitenant deployment of Red Hat OpenShift Service Mesh 2.6.14, and are migrating to OpenShift Service Mesh 3.0.
3.1.1. Migrating a multitenant deployment Copy linkLink copied to clipboard!
This example with the bookinfo application demonstrates how to configure a tenant in the Istio resource. You can follow the same steps with your own workloads.
Prerequisites
- You have deployed OpenShift Container Platform 4.14 or later.
- You have logged in to the OpenShift Container Platform web console as a user with the cluster-admin role.
- You have completed the premigration checklists.
- You have the OpenShift Service Mesh 2.6.14 Operator installed.
- You have the OpenShift Service Mesh 3 Operator installed.
-
You created an
IstioCNIresource. -
You have the
istioctltool installed. -
You are running a
MultiTenantServiceMeshControlPlane. -
You have installed the
bookinfoapplication.
Procedure
Create your
Istioresource based on the following example:apiVersion: sailoperator.io/v1 kind: Istio metadata: name: istio-tenant-a spec: namespace: istio-system-tenant-a version: v1.24.3 values: meshConfig: discoverySelectors: - matchLabels: tenant: tenant-a extensionProviders: - name: prometheus prometheus: {} - name: otel opentelemetry: port: 4317 service: otel-collector.opentelemetrycollector-3.svc.cluster.localspec.namespacespecifies the field in yourIstioresource. It must be the same namespace as yourServiceMeshControlPlaneresource. If you set thespec.namespacefield in yourIstioresource to a different namespace, the migration does not complete successfully.WarningAdding new namespaces to the mesh during the migration is not recommended and requires extra caution. In multitenant mode, a control plane only interacts with namespaces that are part of its mesh. When you install the 3.0 control plane in the same namespace as the 2.6 control plane, leader election determines which one manages the
istio-ca-root-certConfigMap. If the 2.6 control plane becomes the leader, it does not distribute thisConfigMapto new namespaces managed by the 3.0 control plane. As a result, sidecar injection fails because the required root certificate is missing.spec.values.meshConfig.discoverySelectorsspecifies the labels that the control plane uses to identify the namespaces it should manage. By default, control planes watch the entire cluster. When managing multiple control planes on a single cluster, you must narrow the scope of each control plane by settingdiscoverySelectorsfields.This example uses the label
tenant-a, but you can use any label or combination of labels. The labels must match yourdiscoverySelectorsfields.-
spec.values.meshConfig.extensionProvidersspecifies the metrics and tracing configurations for the control plane. Optional: If you are migrating metrics and tracing, update theextensionProvidersfields according to your tracing and metrics configurations.
Add your
tenantlabel to each one of your data plane namespaces by running the following command for each data plane namespace:$ oc label ns bookinfo tenant=tenant-a
3.1.2. Migrating workloads in a multitenant deployment Copy linkLink copied to clipboard!
Now you can migrate your workloads from the OpenShift Service Mesh 2.6 control plane to the OpenShift Service Mesh 3.0 control plane.
You can migrate workloads and gateways separately, and in any order. For more information, see "Migrating gateways".
Procedure
Find the current
IstioRevisionfor your OpenShift Service Mesh 3.0 control plane by running the following command:$ oc get istios istio-tenant-aExample output:
NAME REVISIONS READY IN USE ACTIVE REVISION STATUS VERSION AGE istio-tenant-a 1 1 0 istio-tenant-a Healthy v1.24.3 30sNoteThe naming format of your revisions depends on which upgrade strategy you choose for your
Istioinstance.-
Copy the
ACTIVE REVISIONto use as youristio.io/revlabel in the next step. Update injection labels on the
dataplanenamespace by running the following command:$ oc label ns bookinfo istio.io/rev=istio-tenant-a maistra.io/ignore-namespace="true" --overwrite=trueThis adds the following labels to the namespace:
-
The
istio.io/rev: istio-tenant-alabel: Ensures that any new pods that get created in that namespace connect to the OpenShift Service Mesh 3.0 proxy. The
maistra.io/ignore-namespace: "true"label: Disables sidecar injection for OpenShift Service Mesh 2.6 proxies in the namespace so OpenShift Service Mesh 2.6 stops injecting proxies in this namespace, and any new proxies are injected by OpenShift Service Mesh 3.0. Without this label, the OpenShift Service Mesh 2.6 injection webhook tries to inject the pod and the injected sidecar proxy will refuse to start since it will have both the OpenShift Service Mesh 2.6 and the OpenShift Service Mesh 3.0 Container Network Interface(CNI) annotations.NoteOnce you apply the
maistra.io/ignore-namespacelabel, any new pod that gets created in the namespace will connect to the OpenShift Service Mesh 3.0 proxy. Workloads can still communicate with each other regardless of which controlplane they are connected to.
-
The
Restart the workloads by using one of the following options:
To restart all the workloads at once so that the new pods are injected with the OpenShift Service Mesh 3.0 proxy, run the following command:
$ oc rollout restart deployments -n bookinfoTo restart each workload individually, run the following command for each workload:
$ oc rollout restart deployments productpage-v1 -n bookinfo
Wait for the
productpageapplication to restart by running the following command:$ oc rollout status deployment productpage-v1 -n bookinfo
Verification
Check that your workload is connected to the new control plane.
Fetch the list of proxies that are still connected to the OpenShift Service Mesh 2.6 control plane with the
istioctltool by running the following command:$ istioctl ps --istioNamespace istio-system-tenant-a --revision basicIn the following example,
basicis the name of yourServiceMeshControlPlane:NAME CLUSTER CDS LDS EDS RDS ECDS ISTIOD VERSION details-v1-7b49464bc-zr7nr.bookinfo Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-basic-6c9f8d9894-sh6lx 1.20.8 ratings-v1-d6f449f59-9rds2.bookinfo Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-basic-6c9f8d9894-sh6lx 1.20.8 reviews-v1-686cd989df-9x59z.bookinfo Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-basic-6c9f8d9894-sh6lx 1.20.8 reviews-v2-785b8b48fc-l7xkj.bookinfo Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-basic-6c9f8d9894-sh6lx 1.20.8 reviews-v3-67889ffd49-7bhxn.bookinfo Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-basic-6c9f8d9894-sh6lx 1.20.8View the list proxies that have been migrated to the new OpenShift Service Mesh 3.0 control plane by running the following command:
$ istioctl ps --istioNamespace istio-system-tenant-a --revision istio-tenant-aExample output:
NAME CLUSTER CDS LDS EDS RDS ECDS ISTIOD VERSION productpage-v1-7745c5cc94-wpvth.bookinfo Kubernetes SYNCED SYNCED SYNCED SYNCED istiod-5bbf98dccf-n8566 1.24.3
Verify your application is still working correctly. For the
bookinfoapplication, run the following command:$ oc exec -it -n bookinfo deployments/productpage-v1 -c istio-proxy -- curl localhost:9080/productpage
If you are using gateways, you must migrate them before you complete the migration process for your deployment and workloads. If you are not using gateways, and have verified your mulitenant migration, you can proceed to complete the migration and remove OpenShift Service Mesh 2 resources.
3.1.3. Migrating a multitenant deployment with cert-manager Copy linkLink copied to clipboard!
The bookinfo example application is used for demonstration purposes with a minimal example for the Istio resource. For more information on configuration differences between the OpenShift Service Mesh 2 ServiceMeshControlPlane resource and the OpenShift Service Mesh 3 Istio resource, see "ServiceMeshControlPlane resource to Istio resource fields mapping".
You can follow these same steps with your own workloads.
Prerequisites
- You have deployed OpenShift Container Platform 4.14 or later.
- You have logged in to the OpenShift Container Platform web console as a user with the cluster-admin role.
- You have completed the premigration checklists.
- You have the OpenShift Service Mesh 2.6.14 Operator installed.
- You have the OpenShift Service Mesh 3 Operator installed.
-
You created an
IstioCNIresource. -
You have the
istioctltool installed. - You are using the cert-manager and istio-csr tools in a multitenant deployment.
-
Your OpenShift Service Mesh 2
ServiceMeshControlPlaneis configured with the cert-manager tool.
Procedure
Check that your OpenShift Service Mesh 2
ServiceMeshControlPlaneis configured with the cert-manager-tool:You can see the following example configuration for reference:
apiVersion: maistra.io/v2 kind: ServiceMeshControlPlane metadata: name: basic namespace: istio-system spec: ... security: certificateAuthority: cert-manager: address: cert-manager-istio-csr.istio-system.svc:443 type: cert-manager dataPlane: mtls: true identity: type: ThirdParty manageNetworkPolicy: falseUpdate the
istio-csrdeployment to include your OpenShift Service Mesh 3 control plane by running the following command:helm upgrade cert-manager-istio-csr jetstack/cert-manager-istio-csr \ --install \ --reuse-values \ --namespace istio-system \ --wait \ --set "app.istio.revisions={basic,istio-tenant-a}"where:
app.istio.revisions-
This field needs to include your OpenShift Service Mesh 3.0 control plane revision before you create your
Istioresource so that proxies can properly communicate with the OpenShift Service Mesh 3.0 control plane.
Create your
Istioresource.You can see the following example configuration for reference:
apiVersion: sailoperator.io/v1 kind: Istio metadata: name: istio-tenant-a spec: namespace: istio-system-tenant-a version: v1.24.3 values: meshConfig: discoverySelectors: - matchLabels: tenant: tenant-a extensionProviders: - name: prometheus prometheus: {} - name: otel opentelemetry: port: 4317 service: otel-collector.opentelemetrycollector-3.svc.cluster.local global: caAddress: cert-manager-istio-csr.istio-system.svc:443 pilot: env: ENABLE_CA_SERVER: "false"-
spec.namespacespecifies the namespace for yourIstioresource must be the same namespace as yourServiceMeshControlPlaneresource. If you set thespec.namespacefield in yourIstioresource to a different namespace than yourServiceMeshControlPlaneresource, the migration will not work properly. -
spec.values.meshConfig.discoverySelectorsspecifies the label selector for yourIstioresource. By default, control planes watch the entire cluster. When managing multiple control planes on a single cluster, you must narrow the scope of each control plane by settingdiscoverySelectorsfields. In this example, the labeltenant-ais used, but you can use any label or combination of labels. -
spec.values.meshConfig.extensionProvidersis an optional field. If you are migrating metrics and tracing, update theextensionProvidersfields according to your tracing and metrics configurations.
-
Add your
tenantlabel to each one of your dataplane namespaces by running the following command for each dataplane namespace:$ oc label ns bookinfo tenant=tenant-aNoteWith OpenShift Service Mesh 2.6, namespaces were enrolled into the mesh by adding them to the
ServiceMeshMemberRollresource. In OpenShift Service Mesh 3, you must label each one of your dataplane namespaces to match yourdiscoverySelectorsfields.
3.1.4. Migrating workloads in a multitenant deployment with cert-manager Copy linkLink copied to clipboard!
Now you can migrate your workloads from the OpenShift Service Mesh 2.6 control plane to the OpenShift Service Mesh 3.0 control plane.
You can migrate workloads and gateways separately, and in any order. For more information, see "Migrating gateways".
Procedure
Find the current
IstioRevisionfor your OpenShift Service Mesh 3.0 control plane by running the following command:$ oc get istios istio-tenant-aExample output:
NAME REVISIONS READY IN USE ACTIVE REVISION STATUS VERSION AGE istio-tenant-a 1 1 0 istio-tenant-a Healthy v1.24.3 30sNoteThe naming format of your revisions depends on which upgrade strategy you choose for your
Istioinstance.-
Copy the
ACTIVE REVISIONto use as youristio.io/revlabel in the next step. Update injection labels on the
dataplanenamespace by running the following command:$ oc label ns bookinfo istio.io/rev=istio-tenant-a maistra.io/ignore-namespace="true" --overwrite=trueThis adds the following labels to the namespace:
-
The
istio.io/rev: istio-tenant-alabel: Ensures that any new pods that get created in that namespace connect to the OpenShift Service Mesh 3.0 proxy. The
maistra.io/ignore-namespace: "true"label: Disables sidecar injection for OpenShift Service Mesh 2.6 proxies in the namespace so OpenShift Service Mesh 2.6 stops injecting proxies in this namespace, and any new proxies are injected by OpenShift Service Mesh 3.0. Without this label, the OpenShift Service Mesh 2.6 injection webhook tries to inject the pod and the injected sidecar proxy will refuse to start since it will have both the OpenShift Service Mesh 2.6 and the OpenShift Service Mesh 3.0 Container Network Interface(CNI) annotations.NoteOnce you apply the
maistra.io/ignore-namespacelabel, any new pod that gets created in the namespace connects to the OpenShift Service Mesh 3.0 proxy. Workloads can still communicate with each other regardless of which controlplane they are connected to.
-
The
Restart the workloads by using one of the following options:
To restart all the workloads at once so that the new pods are injected with the OpenShift Service Mesh 3.0 proxy, run the following command:
$ oc rollout restart deployments -n bookinfoTo restart each workload individually, run the following command for each workload:
$ oc rollout restart deployments productpage-v1 -n bookinfo
Wait for the
productpageapplication to restart by running the following command:$ oc rollout status deployment productpage-v1 -n bookinfo
Verification
Check that your workload is connected to the new control plane.
Fetch the list of proxies that are still connected to the OpenShift Service Mesh 2.6 control plane with the
istioctltool by running the following command:$ istioctl ps --istioNamespace istio-system-tenant-a --revision basicIn the following example,
basicis the name of yourServiceMeshControlPlane:NAME CLUSTER CDS LDS EDS RDS ECDS ISTIOD VERSION details-v1-7b49464bc-zr7nr.bookinfo Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-basic-6c9f8d9894-sh6lx 1.20.8 ratings-v1-d6f449f59-9rds2.bookinfo Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-basic-6c9f8d9894-sh6lx 1.20.8 reviews-v1-686cd989df-9x59z.bookinfo Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-basic-6c9f8d9894-sh6lx 1.20.8 reviews-v2-785b8b48fc-l7xkj.bookinfo Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-basic-6c9f8d9894-sh6lx 1.20.8 reviews-v3-67889ffd49-7bhxn.bookinfo Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-basic-6c9f8d9894-sh6lx 1.20.8View the list proxies that have been migrated to the new OpenShift Service Mesh 3.0 control plane by running the following command:
$ istioctl ps --istioNamespace istio-system-tenant-a --revision istio-tenant-aExample output:
NAME CLUSTER CDS LDS EDS RDS ECDS ISTIOD VERSION productpage-v1-7745c5cc94-wpvth.bookinfo Kubernetes SYNCED SYNCED SYNCED SYNCED istiod-5bbf98dccf-n8566 1.24.3
Verify your application is still working correctly. For the
bookinfoapplication, run the following command:$ oc exec -it -n bookinfo deployments/productpage-v1 -c istio-proxy -- curl localhost:9080/productpage
If you are using gateways, you must migrate them before you complete the migration process for your deployment and workloads. After you have migrated your gateways, you must update the app.controller.configmapNamespaceSelector field in your istio-csr deployment. If you are not using gateways, you can complete your migration with cert-manager.