将 Portworx 卷从HPCS迁移到 Key Protect

请将 Portworx 存储卷的 Hyper Protect Crypto Services (HPCS)加密迁移至 IBM Key Protect ( Key Protect )。

准备工作

在将您的 Portworx 加密卷从 Hyper Protect Crypto Services 迁移到 Key Protect 之前,请完成以下步骤。

  1. 访问您的 Red Hat OpenShift 集群
  2. 请确保已安装 Key Protect 命令行插件
  3. 如果您还没有,请创建一个 Key Protect 实例,用于此次迁移。
  4. 请确保您已获取用于迁移卷的 Portworx HPCS 至 Key Protect 迁移脚本。 当您申请工具访问权限时,该工具将包含在 hpcs-2-kp-k8s.zip 文件中。 有关更多信息,请参阅 迁移概述 中的步骤 1。

迁移 Portworx 加密卷

请按照以下步骤,将您的 Portworx 加密卷从 Hyper Protect Crypto Services 迁移至 Key Protect。 这些步骤包括运行一个迁移脚本。

  1. 将您的 IBM Cloud API密钥设置为环境变量。

    export IC_API_KEY="YOUR_API_KEY"
    
  2. 使用所需的参数运行迁移脚本。 请将占位符替换为您具体的配置信息。

    ./hpcs_kp_px_migration_script.sh \
      --region us-south \
      --resource-group Default \
      --hpcs-endpoint https://api.us-south.hs-crypto.cloud.ibm.com:8389/ \
      --hpcs-instance-id <hpcs-instance-id> \
      --hpcs-root-key-id <hpcs-root-key-id> \
      --kp-endpoint https://us-south.kms.cloud.ibm.com/ \
      --kp-instance-id <kp-instance-id> \
      --kp-root-key-id <kp-root-key-id> \
      --cluster-name my-px-cluster \
      --etcd-endpoints <etcd-endpoints> \
      --px-namespace kube-system
    

    请参阅下表了解所需的命令参数。

    迁移脚本标志
    标志 描述
    --region IBM Cloud 地区(例如,us-south )。
    --resource-group IBM Cloud 资源组。
    --hpcs-endpoint Hyper Protect Crypto Services 密钥管理端点 URL。
    --hpcs-instance-id Hyper Protect Crypto Services 实例 ID。
    --hpcs-root-key-id Hyper Protect Crypto Services 根密钥 ID。
    --kp-endpoint Key Protect 端点 URL。
    --kp-instance-id Key Protect 实例 ID。
    --kp-root-key-id Key Protect 根密钥 ID。
    --cluster-name Portworx 集群名称(来自 pxctl status 的输出)。
    --px-namespace Portworx 在您的集群上运行的命名空间。
  3. 迁移脚本完成后,请更新 portworx 命名空间中的 px-ibm Kubernetes 密钥,使其指向您配置的 Key Protect 实例和根密钥。 请更新以下字段:

    • IBM_SERVICE_API_KEY
    • IBM_INSTANCE_ID
    • IBM_BASE_URL
    • IBM_CUSTOMER_ROOT_KEY
  4. 在每个集群节点上重启 Portworx。 请等待每个节点上的 Portworx 显示为“正常”状态,然后再继续进行下一步。

    在某个节点上重启 Portworx。

    kubectl label node px/service=restart
    
  5. 请验证加密卷是否可访问,并确保新创建的卷使用 Key Protect 作为密钥管理服务(KMS)。