6.2.3. 使用 cns-deploy 升级现有版本


6.2.3.1. 升级 cns-deploy 和 Heketi Server

必须在客户端计算机上执行以下命令。

  1. 执行以下命令来更新 heketi 客户端和 cns-deploy 软件包:

    # yum update cns-deploy -y
    # yum update heketi-client -y
  2. 备份 Heketi registry 数据库文件

    # heketi-cli db dump > heketi-db-dump-$(date -I).json
  3. 执行以下命令来删除 heketi 模板。

    # oc delete templates heketi
  4. 执行以下命令以获取当前的 HEKETI_ADMIN_KEY:

    只要其基础架构不使用,OCS 管理员可以选择为用户密钥设置任何短语。它没有被任何 OCS 默认安装的资源使用。

    # oc get secret <heketi-admin-secret-name> -o jsonpath='{.data.key}'|base64 -d;echo
  5. 执行以下命令来安装 heketi 模板。

    # oc create -f /usr/share/heketi/templates/heketi-template.yaml
    template "heketi" created
  6. 执行以下命令,将 heketi 服务帐户授予必要的特权。

    # oc policy add-role-to-user edit system:serviceaccount:<project_name>:heketi-service-account
    # oc adm policy add-scc-to-user privileged -z heketi-service-account

    例如,

    # oc policy add-role-to-user edit system:serviceaccount:storage-project:heketi-service-account
    # oc adm policy add-scc-to-user privileged -z heketi-service-account
    注意

    heketi pod 中使用的服务帐户需要具有特权,因为 Heketi/rhgs-volmanager pod 将 heketidb 存储 Gluster 卷作为"glusterfs"卷类型而不是 PersistentVolume(PV)挂载。
    根据 OpenShift 中的 security-context-constraints 法规,挂载类型不是 configMap、Downward、emptyDir、hostPath、nfs 和 persistentVolumeClaim 的卷,secret 只会被授予具有特权安全上下文约束(SCC)的帐户。

  7. 执行以下命令来生成新的 heketi 配置文件。

    # sed -e "s/\${HEKETI_EXECUTOR}/kubernetes/" -e "s#\${HEKETI_FSTAB}#/var/lib/heketi/fstab#" -e "s/\${SSH_PORT}/22/" -e "s/\${SSH_USER}/root/" -e "s/\${SSH_SUDO}/false/" -e "s/\${BLOCK_HOST_CREATE}/true/" -e "s/\${BLOCK_HOST_SIZE}/500/" "/usr/share/heketi/templates/heketi.json.template" > heketi.json
    • BLOCK_HOST_SIZE 参数控制自动创建的 Red Hat Gluster Storage 卷的大小(以 GB 为单位)用于托管 gluster-block 卷(更多信息,请参阅 https://access.redhat.com/documentation/en-us/red_hat_openshift_container_storage/3.11/html-single/operations_guide/index#Block_Storage)。此默认配置将动态创建块托管大小为 500GB 的卷,因为需要更多空间。
    • 或者,将 /usr/share/heketi/templates/heketi.json.template 文件复制到当前目录中的 heketi.json,并直接编辑新文件,将每个"${VARIABLE}" 字符串替换为所需参数。

      注意

      JSON 格式严格是必需的(例如,没有结尾的空格、布尔值都为小写)。

  8. 执行以下命令,以创建用于存放配置文件的机密。

    # oc create secret generic <heketi-registry-config-secret> --from-file=heketi.json
    注意

    如果 heketi-registry-config-secret 文件已经存在,则删除该文件并运行以下命令:

  9. 执行以下命令删除 heketi 的部署配置、服务和路由:

    # oc delete deploymentconfig,service,route heketi-registry
  10. 编辑 heketi 模板。

    • 编辑 HEKETI_USER_KEY 和 HEKETI_ADMIN_KEY 参数。

      # oc edit template heketi
      parameters:
      - description: Set secret for those creating volumes as type user
        displayName: Heketi User Secret
        name: HEKETI_USER_KEY
        value: <heketiuserkey>
      - description: Set secret for administration of the Heketi service as user admin
        displayName: Heketi Administrator Secret
        name: HEKETI_ADMIN_KEY
        value: <adminkey>
      - description: Set the executor type, kubernetes or ssh
        displayName: heketi executor type
        name: HEKETI_EXECUTOR
        value: kubernetes
      - description: Set the hostname for the route URL
        displayName: heketi route name
        name: HEKETI_ROUTE
        value: heketi-storage
      - displayName: heketi container image name
        name: IMAGE_NAME
        required: true
        value: registry.redhat.io/rhgs3/rhgs-volmanager-rhel7
      - displayName: heketi container image version
        name: IMAGE_VERSION
        required: true
        value: v3.11.8
      - description: A unique name to identify this heketi service, useful for running
          multiple heketi instances
        displayName: GlusterFS cluster name
        name: CLUSTER_NAME
        value: storage
      注意

      如果集群有超过 1000 个卷,请参阅 如何更改 Openshift Container Storage 的默认 PVS 限制 ,并在进行升级前添加必要的参数。

    • 添加名为 HEKETI_LVM_WRAPPER 且值为 /usr/sbin/exec-on-host 的 ENV。

      - description: Heketi can use a wrapper to execute LVM commands, i.e. run commands
      in the host namespace instead of in the Gluster container.
      displayName: Wrapper for executing LVM commands
      name: HEKETI_LVM_WRAPPER
      value: /usr/sbin/exec-on-host
    • 添加一个名为 HEKETI_DEBUG_UMOUNT_FAILURES,值为 true 的 ENV。

      - description: When unmounting a brick fails, Heketi will not be able to cleanup the
      Gluster volume completely. The main causes for preventing to unmount a brick,
      seem to originate from Gluster processes. By enabling this option, the heketi.log
      will contain the output of 'lsof' to aid with debugging of the Gluster processes
      and help with identifying any files that may be left open.
      displayName: Capture more details in case brick unmounting fails
      name: HEKETI_DEBUG_UMOUNT_FAILURES
      required=true
    • 添加一个带有名为 HEKETI_CLI_USER,值为 admin 的 ENV。
    • 添加名为 HEKETI_CLI_KEY 以及为 ENV HEKETI_ADMIN_KEY 提供的相同值的 ENV。
    • 根据您要升级到的版本,将 IMAGE_VERSION 中的替换为 v3.11.5v3.11.8

      - displayName: heketi container image name
        name: IMAGE_NAME
        required: true
        value: registry.redhat.io/rhgs3/rhgs-volmanager-rhel7
      - displayName: heketi container image version
        name: IMAGE_VERSION
        required: true
        value: v3.11.8
  11. 执行以下命令来部署用于为 OpenShift 创建持久性卷的 Heketi 服务、路由和部署配置:

    # oc process heketi | oc create -f -
    
    service "heketi-registry" created
    route "heketi-registry" created
    deploymentconfig-registry "heketi" created
    注意

    建议为数据库工作负载调整 heketidbstorage 卷。新安装的 Openshift Container Storage 部署会自动调整 heketidbstorage 卷。对于旧的部署,请按照 KCS 文章 规划在 Openshift Container Storage 上运行容器化 DB 或 nosql 工作负载? 并为卷 heketidbstorage 执行卷设置操作。

  12. 执行以下命令来验证容器是否正在运行:

    # oc get pods

    例如:

    # oc get pods
    NAME                                          READY     STATUS    RESTARTS   AGE
    glusterblock-storage-provisioner-dc-1-ffgs5   1/1       Running   0          3m
    glusterfs-storage-5thpc                       1/1       Running   0          9d
    glusterfs-storage-hfttr                       1/1       Running   0          9d
    glusterfs-storage-n8rg5                       1/1       Running   0          9d
    heketi-storage-4-9fnvz                        2/2       Running   0          8d
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部