This topic describes how to mount a disk to a Kubernetes cluster node. Mounting a disk allows you to expand the Docker data directory and maintain a sufficient disk capacity when the number of containers or images that run on a node increases.


Your Kubernetes cluster version must be v1.10.4 or later.

You can mount a disk to an existing Kubernetes cluster node by using either of the following methods:
  • If no disk is mounted to the existing node, see Mount a disk to the Docker data directory.
  • If you have created a disk for the existing node, but you have failed to mount the disk to the node, you can follow these steps.
  • We recommend that you create a snapshot of the target node or back up node data to avoid data loss.
  • Additionally, you must ensure that you can schedule your cluster applications to other nodes.
  • We recommend that you perform this operation during off-peak service hours to avoid disruptions to your business.
  • Draining a node reschedules pods on the node to other nodes. Therefore, you must ensure that your Kubernetes cluster has sufficient nodes. We recommend that you add cluster nodes in advance as needed.
Before performing the operation, you need to determine whether a disk is already mounted to the target cluster node. To do so, run the df command on the target Worker node, and then check whether /var/lib/docker has been mounted to /dev/vdb1. If the disk mounting operation failed, you can mount the disk by following these steps.

  1. Set the target node as unschedulable. For more information, see Mark node as unschedulable.
  2. Drain the target node. For more information, see Safely drain a node.
  3. Remove the target node. This topic uses the Container Service console as an example.
    1. Log on to the Container Service console.
    2. In the left-side navigation pane, click Node.
    3. Select the target node, and click Remove or choose More > Remove.

    4. In the displayed Remove Node dialog box, click OK.

      Note We recommend that you do not select the Release ECS at the same time check box. Otherwise, the ECS instance used by the target node will be released.
  4. Add the removed node to the cluster.
    1. In the left-side navigation pane, click Clusters.
    2. On the right of the target cluster, choose More > Add Existing Instance.

    3. Select Automatically Add or Manually Add. In this example, the instance is added automatically. 

    4. Select the existing instance and then click Next Step.
    5. Turn on the Format Data Disk switch.

    6. Complete other required settings.

After the node has been added to the cluster, you can log on to the node to run the df command to check whether a disk has been mounted to the target node.

The following figure shows the disk has been amounted to the target node.