1.27. 卸载 Service Mesh

要从现有的 OpenShift Container Platform 实例卸载 Red Hat OpenShift Service Mesh 并删除其资源,您必须删除 control plane、删除 Operator,并运行命令来手动删除某些资源。

1.27.1. 删除 Red Hat OpenShift Service Mesh control plane

要从现有的 OpenShift Container Platform 实例卸载 Service Mesh,首先删除 Service Mesh control plane 和 Operator。然后,您将运行命令来删除剩余的资源。

1.27.1.1. 使用 Web 控制台删除 Service Mesh control plane

您可以使用 Web 控制台删除 Red Hat OpenShift Service Mesh control plane。

流程

  1. 登陆到 OpenShift Container Platform Web 控制台。
  2. Project 菜单,选择安装 Service Mesh control plane 的项目,如 istio-system
  3. 导航到 OperatorsInstalled Operators
  4. Provided APIs 下的 Service Mesh Control Plane
  5. ServiceMeshControlPlane 菜单 kebab .
  6. Delete Service Mesh Control Plane
  7. 在确认窗口中点 Delete 删除 ServiceMeshControlPlane

1.27.1.2. 使用 CLI 删除 Service Mesh control plane

您可以使用 CLI 删除 Red Hat OpenShift Service Mesh control plane。在本例中,istio-system 是 control plane 项目的名称。

流程

  1. 登录 OpenShift Container Platform CLI。
  2. 运行以下命令以删除 ServiceMeshMemberRoll 资源。

    $ oc delete smmr -n istio-system default
  3. 运行这个命令来获得安装的 ServiceMeshControlPlane 的名称:

    $ oc get smcp -n istio-system
  4. 使用以上命令中的输出替换 <name_of_custom_resource>,运行这个命令来删除自定义资源:

    $ oc delete smcp -n istio-system <name_of_custom_resource>

1.27.2. 删除安装的 Operator

您必须删除 Operator 才可以成功删除 Red Hat OpenShift Service Mesh。删除 Red Hat OpenShift Service Mesh Operator 后,您必须删除 Kiali Operator、Red Hat OpenShift distributed tracing Platform Operator 和 OpenShift Elasticsearch Operator。

1.27.2.1. 删除 Operator

按照以下步骤删除组成 Red Hat OpenShift Service Mesh 的 Operator。对以下每个 Operator 重复上述步骤。

  • Red Hat OpenShift Service Mesh
  • Kiali
  • Red Hat OpenShift distributed tracing Platform
  • OpenShift Elasticsearch

流程

  1. 登陆到 OpenShift Container Platform Web 控制台。
  2. OperatorsInstalled Operators 页面中,滚动页面或在 Filter by name 中输入关键字以查找每个 Operator。然后点击 Operator 名称。
  3. Operator Details 页面中,从 Actions 菜单中选择 Uninstall Operator。按照提示卸载每个 Operator。

1.27.3. 清理 Operator 资源

您可以使用 OpenShift Container Platform Web 控制台手动删除 Red Hat OpenShift Service Mesh Operator 后保留的资源。

先决条件

  • 具有集群管理访问权限的帐户。如果使用 Red Hat OpenShift Dedicated,则必须有一个具有 dedicated-admin 角色的帐户。
  • 访问 OpenShift CLI(oc)。

流程

  1. 以集群管理员身份登录到 OpenShift Container Platform CLI。
  2. 在卸载 Operators 后运行以下命令清理资源。如果您要在没有服务网格的情况下将分布式追踪平台用作独立服务,请不要删除 Jaeger 资源。

    注意

    OpenShift Elasticsearch Operator 默认安装在 openshift-operators-redhat 中。其他 Operator 默认安装在 openshift-operators 命名空间中。如果在另一个命名空间中安装了 Operator,将 openshift-operators 替换为安装了 Red Hat OpenShift Service Mesh Operator 的项目的名称。

    $ oc delete validatingwebhookconfiguration/openshift-operators.servicemesh-resources.maistra.io
    $ oc delete mutatingwebhookconfiguration/openshift-operators.servicemesh-resources.maistra.io
    $ oc delete svc maistra-admission-controller -n openshift-operators
    $ oc -n openshift-operators delete ds -lmaistra-version
    $ oc delete clusterrole/istio-admin clusterrole/istio-cni clusterrolebinding/istio-cni
    $ oc delete clusterrole istio-view istio-edit
    $ oc delete clusterrole jaegers.jaegertracing.io-v1-admin jaegers.jaegertracing.io-v1-crdview jaegers.jaegertracing.io-v1-edit jaegers.jaegertracing.io-v1-view
    $ oc get crds -o name | grep '.*\.istio\.io' | xargs -r -n 1 oc delete
    $ oc get crds -o name | grep '.*\.maistra\.io' | xargs -r -n 1 oc delete
    $ oc get crds -o name | grep '.*\.kiali\.io' | xargs -r -n 1 oc delete
    $ oc delete crds jaegers.jaegertracing.io
    $ oc delete cm -n openshift-operators maistra-operator-cabundle
    $ oc delete cm -n openshift-operators istio-cni-config istio-cni-config-v2-3
    $ oc delete sa -n openshift-operators istio-cni