第 2 章 OpenShift Data Foundation deployed using local storage devices


2.1. Replacing storage nodes on bare metal infrastructure

Prerequisites

  • Ensure that the replacement nodes are configured with similar infrastructure, resources, and disks to the node that you replace.
  • You must be logged into the OpenShift Container Platform cluster.

Procedure

  1. Identify the node, and get the labels on the node that you need to replace:

    $ oc get nodes --show-labels | grep <node_name>
    <node_name>
    Specify the name of node that you need to replace.
  2. Identify the monitor pod (if any), and OSDs that are running in the node that you need to replace:

    $ oc get pods -n openshift-storage -o wide | grep -i <node_name>
  3. Scale down the deployments of the pods identified in the previous step:

    For example:

    $ oc scale deployment rook-ceph-mon-c --replicas=0 -n openshift-storage
    $ oc scale deployment rook-ceph-osd-0 --replicas=0 -n openshift-storage
    $ oc scale deployment --selector=app=rook-ceph-crashcollector,node_name=<node_name>  --replicas=0 -n openshift-storage
  4. Mark the node as unschedulable:

    $ oc adm cordon <node_name>
  5. Drain the node:

    $ oc adm drain <node_name> --force --delete-emptydir-data=true --ignore-daemonsets
  6. Delete the node:

    $ oc delete node <node_name>
  7. Get a new bare-metal machine with the required infrastructure. See Installing on bare metal.

    重要

    For information about how to replace a master node when you have installed OpenShift Data Foundation on a three-node OpenShift compact bare-metal cluster, see the Backup and Restore guide in the OpenShift Container Platform documentation.

  8. Create a new OpenShift Container Platform node using the new bare-metal machine.
  9. Check for the Certificate Signing Requests (CSRs) related to OpenShift Container Platform that are in Pending state:

    $ oc get csr
  10. Approve all the required OpenShift Container Platform CSRs for the new node:

    $ oc adm certificate approve <certificate_name>
    <certificate_name>
    Specify the name of the CSR.
  11. Click Compute Nodes in the OpenShift Web Console. Confirm that the new node is in Ready state.
  12. Apply the OpenShift Data Foundation label to the new node using any one of the following:

    From the user interface
    1. For the new node, click Action Menu (⋮) Edit Labels.
    2. Add cluster.ocs.openshift.io/openshift-storage, and click Save.
    From the command-line interface
    • Apply the OpenShift Data Foundation label to the new node:
    $ oc label node <new_node_name> cluster.ocs.openshift.io/openshift-storage=""
    <new_node_name>
    Specify the name of the new node.
  13. Identify the namespace where OpenShift local storage operator is installed, and assign it to the local_storage_project variable:

    $ local_storage_project=$(oc get csv --all-namespaces | awk '{print $1}' | grep local)

    For example:

    $ local_storage_project=$(oc get csv --all-namespaces | awk '{print $1}' | grep local)
    echo $local_storage_project

    Example output:

    openshift-local-storage
  14. Add a new worker node to the localVolumeDiscovery and localVolumeSet.

    1. Update the localVolumeDiscovery definition to include the new node, and remove the failed node:

      # oc edit -n $local_storage_project localvolumediscovery auto-discover-devices

      Example output:

      [...]
         nodeSelector:
          nodeSelectorTerms:
            - matchExpressions:
                - key: kubernetes.io/hostname
                  operator: In
                  values:
                  - server1.example.com
                  - server2.example.com
                  #- server3.example.com
                  - newnode.example.com
      [...]

      Remember to save before exiting the editor.

      In this example, server3.example.com is removed, and newnode.example.com is the new node.

    2. Determine the localVolumeSet to edit:

      # oc get -n $local_storage_project localvolumeset

      Example output:

      NAME          AGE
      localblock   25h
    3. Update the localVolumeSet definition to include the new node, and remove the failed node:

      # oc edit -n $local_storage_project localvolumeset localblock

      Example output:

      [...]
         nodeSelector:
          nodeSelectorTerms:
            - matchExpressions:
                - key: kubernetes.io/hostname
                  operator: In
                  values:
                  - server1.example.com
                  - server2.example.com
                  #- server3.example.com
                  - newnode.example.com
      [...]

      Remember to save before exiting the editor.

      In the this example, server3.example.com is removed and newnode.example.com is the new node.

  15. Verify that the new localblock Persistent Volume (PV) is available:

    $oc get pv | grep localblock | grep Available

    Example output:

    local-pv-551d950     512Gi    RWO    Delete  Available
    localblock     26s
  16. Navigate to the openshift-storage project:

    $ oc project openshift-storage
  17. Remove the failed OSD from the cluster. You can specify multiple failed OSDs if required:

    $ oc process -n openshift-storage ocs-osd-removal \
    -p FAILED_OSD_IDS=<failed_osd_id> | oc create -f -
    <failed_osd_id>

    Is the integer in the pod name immediately after the rook-ceph-osd prefix.

    You can add comma separated OSD IDs in the command to remove more than one OSD, for example, FAILED_OSD_IDS=0,1,2.

    The FORCE_OSD_REMOVAL value must be changed to true in clusters that only have three OSDs, or clusters with insufficient space to restore all three replicas of the data after the OSD is removed.

  18. Verify that the OSD was removed successfully by checking the status of the ocs-osd-removal-job pod.

    A status of Completed confirms that the OSD removal job succeeded.

    # oc get pod -l job-name=ocs-osd-removal-job -n openshift-storage
  19. Ensure that the OSD removal is completed.

    $ oc logs -l job-name=ocs-osd-removal-job -n openshift-storage --tail=-1 | egrep -i 'completed removal'

    Example output:

    2022-05-10 06:50:04.501511 I | cephosd: completed removal of OSD 0
    重要

    If the ocs-osd-removal-job fails, and the pod is not in the expected Completed state, check the pod logs for further debugging:

    For example:

    # oc logs -l job-name=ocs-osd-removal-job -n openshift-storage --tail=-1
  20. Identify the Persistent Volume (PV) associated with the Persistent Volume Claim (PVC):

    # oc get pv -L kubernetes.io/hostname | grep localblock | grep Released

    Example output:

    local-pv-d6bf175b  1490Gi  RWO  Delete  Released  openshift-storage/ocs-deviceset-0-data-0-6c5pw  localblock  2d22h  compute-1

    If there is a PV in Released state, delete it:

    # oc delete pv <persistent_volume>

    For example:

    # oc delete pv local-pv-d6bf175b

    Example output:

    persistentvolume "local-pv-d9c5cbd6" deleted
  21. Identify the crashcollector pod deployment:

    $ oc get deployment --selector=app=rook-ceph-crashcollector,node_name=<failed_node_name> -n openshift-storage

    If there is an existing crashcollector pod deployment, delete it:

    $ oc delete deployment --selector=app=rook-ceph-crashcollector,node_name=<failed_node_name> -n openshift-storage
  22. Delete the ocs-osd-removal-job:

    # oc delete -n openshift-storage job ocs-osd-removal-job

    Example output:

    job.batch "ocs-osd-removal-job" deleted

Verification steps

  1. Verify that the new node is present in the output:

    $ oc get nodes --show-labels | grep cluster.ocs.openshift.io/openshift-storage= |cut -d' ' -f1
  2. Click Workloads Pods. Confirm that at least the following pods on the new node are in Running state:

    • csi-cephfsplugin-*
    • csi-rbdplugin-*
  3. Verify that all other required OpenShift Data Foundation pods are in Running state.

    Ensure that the new incremental mon is created, and is in the Running state:

    $ oc get pod -n openshift-storage | grep mon

    Example output:

    rook-ceph-mon-a-cd575c89b-b6k66         2/2     Running
    0          38m
    rook-ceph-mon-b-6776bc469b-tzzt8        2/2     Running
    0          38m
    rook-ceph-mon-d-5ff5d488b5-7v8xh        2/2     Running
    0          4m8s

    OSD and monitor pod might take several minutes to get to the Running state.

  4. Verify that new OSD pods are running on the replacement node:

    $ oc get pods -o wide -n openshift-storage| egrep -i <new_node_name> | egrep osd
  5. Optional: If cluster-wide encryption is enabled on the cluster, verify that the new OSD devices are encrypted.

    For each of the new nodes identified in the previous step, do the following:

    1. Create a debug pod and open a chroot environment for the one or more selected hosts:

      $ oc debug node/<node_name>
      $ chroot /host
    2. Display the list of available block devices:

      $ lsblk

      Check for the crypt keyword beside the one or more ocs-deviceset names.

  6. If the verification steps fail, contact Red Hat Support.

Prerequisites

  • Ensure that the replacement nodes are configured with similar infrastructure, resources, and disks to the node that you replace.
  • You must be logged into the OpenShift Container Platform cluster.

Procedure

  1. Identify the node, and get the labels on the node that you need to replace:

    $ oc get nodes --show-labels | grep <node_name>
    <node_name>
    Specify the name of node that you need to replace.
  2. Identify the monitor pod (if any), and OSDs that are running in the node that you need to replace:

    $ oc get pods -n openshift-storage -o wide | grep -i <node_name>
  3. Scale down the deployments of the pods identified in the previous step:

    For example:

    $ oc scale deployment rook-ceph-mon-c --replicas=0 -n openshift-storage
    $ oc scale deployment rook-ceph-osd-0 --replicas=0 -n openshift-storage
    $ oc scale deployment --selector=app=rook-ceph-crashcollector,node_name=<node_name>  --replicas=0 -n openshift-storage
  4. Mark the node as unschedulable:

    $ oc adm cordon <node_name>
  5. Remove the pods which are in Terminating state:

    $ oc get pods -A -o wide | grep -i <node_name> |  awk '{if ($4 == "Terminating") system ("oc -n " $1 " delete pods " $2  " --grace-period=0 " " --force ")}'
  6. Drain the node:

    $ oc adm drain <node_name> --force --delete-emptydir-data=true --ignore-daemonsets
  7. Delete the node:

    $ oc delete node <node_name>
  8. Get a new bare-metal machine with the required infrastructure. See Installing on bare metal.

    重要

    For information about how to replace a master node when you have installed OpenShift Data Foundation on a three-node OpenShift compact bare-metal cluster, see the Backup and Restore guide in the OpenShift Container Platform documentation.

  9. Create a new OpenShift Container Platform node using the new bare-metal machine.
  10. Check for the Certificate Signing Requests (CSRs) related to OpenShift Container Platform that are in Pending state:

    $ oc get csr
  11. Approve all the required OpenShift Container Platform CSRs for the new node:

    $ oc adm certificate approve <certificate_name>
    <certificate_name>
    Specify the name of the CSR.
  12. Click Compute Nodes in the OpenShift Web Console. Confirm that the new node is in Ready state.
  13. Apply the OpenShift Data Foundation label to the new node using any one of the following:

    From the user interface
    1. For the new node, click Action Menu (⋮) Edit Labels.
    2. Add cluster.ocs.openshift.io/openshift-storage, and click Save.
    From the command-line interface
    • Apply the OpenShift Data Foundation label to the new node:
    $ oc label node <new_node_name> cluster.ocs.openshift.io/openshift-storage=""
    <new_node_name>
    Specify the name of the new node.
  14. Identify the namespace where OpenShift local storage operator is installed, and assign it to the local_storage_project variable:

    $ local_storage_project=$(oc get csv --all-namespaces | awk '{print $1}' | grep local)

    For example:

    $ local_storage_project=$(oc get csv --all-namespaces | awk '{print $1}' | grep local)
    echo $local_storage_project

    Example output:

    openshift-local-storage
  15. Add a new worker node to the localVolumeDiscovery and localVolumeSet.

    1. Update the localVolumeDiscovery definition to include the new node, and remove the failed node:

      # oc edit -n $local_storage_project localvolumediscovery auto-discover-devices

      Example output:

      [...]
         nodeSelector:
          nodeSelectorTerms:
            - matchExpressions:
                - key: kubernetes.io/hostname
                  operator: In
                  values:
                  - server1.example.com
                  - server2.example.com
                  #- server3.example.com
                  - newnode.example.com
      [...]

      Remember to save before exiting the editor.

      In this example, server3.example.com is removed, and newnode.example.com is the new node.

    2. Determine the localVolumeSet to edit:

      # oc get -n $local_storage_project localvolumeset

      Example output:

      NAME          AGE
      localblock   25h
    3. Update the localVolumeSet definition to include the new node, and remove the failed node:

      # oc edit -n $local_storage_project localvolumeset localblock

      Example output:

      [...]
         nodeSelector:
          nodeSelectorTerms:
            - matchExpressions:
                - key: kubernetes.io/hostname
                  operator: In
                  values:
                  - server1.example.com
                  - server2.example.com
                  #- server3.example.com
                  - newnode.example.com
      [...]

      Remember to save before exiting the editor.

      In the this example, server3.example.com is removed and newnode.example.com is the new node.

  16. Verify that the new localblock Persistent Volume (PV) is available:

    $oc get pv | grep localblock | grep Available

    Example output:

    local-pv-551d950     512Gi    RWO    Delete  Available
    localblock     26s
  17. Navigate to the openshift-storage project:

    $ oc project openshift-storage
  18. Remove the failed OSD from the cluster. You can specify multiple failed OSDs if required:

    $ oc process -n openshift-storage ocs-osd-removal \
    -p FAILED_OSD_IDS=<failed_osd_id> | oc create -f -
    <failed_osd_id>

    Is the integer in the pod name immediately after the rook-ceph-osd prefix.

    You can add comma separated OSD IDs in the command to remove more than one OSD, for example, FAILED_OSD_IDS=0,1,2.

    The FORCE_OSD_REMOVAL value must be changed to true in clusters that only have three OSDs, or clusters with insufficient space to restore all three replicas of the data after the OSD is removed.

  19. Verify that the OSD was removed successfully by checking the status of the ocs-osd-removal-job pod.

    A status of Completed confirms that the OSD removal job succeeded.

    # oc get pod -l job-name=ocs-osd-removal-job -n openshift-storage
  20. Ensure that the OSD removal is completed.

    $ oc logs -l job-name=ocs-osd-removal-job -n openshift-storage --tail=-1 | egrep -i 'completed removal'

    Example output:

    2022-05-10 06:50:04.501511 I | cephosd: completed removal of OSD 0
    重要

    If the ocs-osd-removal-job fails, and the pod is not in the expected Completed state, check the pod logs for further debugging:

    For example:

    # oc logs -l job-name=ocs-osd-removal-job -n openshift-storage --tail=-1
  21. Identify the Persistent Volume (PV) associated with the Persistent Volume Claim (PVC):

    # oc get pv -L kubernetes.io/hostname | grep localblock | grep Released

    Example output:

    local-pv-d6bf175b  1490Gi  RWO  Delete  Released  openshift-storage/ocs-deviceset-0-data-0-6c5pw  localblock  2d22h  compute-1

    If there is a PV in Released state, delete it:

    # oc delete pv <persistent_volume>

    For example:

    # oc delete pv local-pv-d6bf175b

    Example output:

    persistentvolume "local-pv-d9c5cbd6" deleted
  22. Identify the crashcollector pod deployment:

    $ oc get deployment --selector=app=rook-ceph-crashcollector,node_name=<failed_node_name> -n openshift-storage

    If there is an existing crashcollector pod deployment, delete it:

    $ oc delete deployment --selector=app=rook-ceph-crashcollector,node_name=<failed_node_name> -n openshift-storage
  23. Delete the ocs-osd-removal-job:

    # oc delete -n openshift-storage job ocs-osd-removal-job

    Example output:

    job.batch "ocs-osd-removal-job" deleted

Verification steps

  1. Verify that the new node is present in the output:

    $ oc get nodes --show-labels | grep cluster.ocs.openshift.io/openshift-storage= |cut -d' ' -f1
  2. Click Workloads Pods. Confirm that at least the following pods on the new node are in Running state:

    • csi-cephfsplugin-*
    • csi-rbdplugin-*
  3. Verify that all other required OpenShift Data Foundation pods are in Running state.

    Ensure that the new incremental mon is created, and is in the Running state:

    $ oc get pod -n openshift-storage | grep mon

    Example output:

    rook-ceph-mon-a-cd575c89b-b6k66         2/2     Running
    0          38m
    rook-ceph-mon-b-6776bc469b-tzzt8        2/2     Running
    0          38m
    rook-ceph-mon-d-5ff5d488b5-7v8xh        2/2     Running
    0          4m8s

    OSD and monitor pod might take several minutes to get to the Running state.

  4. Verify that new OSD pods are running on the replacement node:

    $ oc get pods -o wide -n openshift-storage| egrep -i <new_node_name> | egrep osd
  5. Optional: If cluster-wide encryption is enabled on the cluster, verify that the new OSD devices are encrypted.

    For each of the new nodes identified in the previous step, do the following:

    1. Create a debug pod and open a chroot environment for the one or more selected hosts:

      $ oc debug node/<node_name>
      $ chroot /host
    2. Display the list of available block devices:

      $ lsblk

      Check for the crypt keyword beside the one or more ocs-deviceset names.

  6. If the verification steps fail, contact Red Hat Support.
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

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

让开源更具包容性

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

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部