Updated on 2024-01-26 GMT+08:00

Expanding the Storage Space

The storage classes that can be expanded for CCE nodes are as follows:

Table 1 Capacity expansion methods

Type

Name

Purpose

Capacity Expansion Method

Node disk

System disk

A disk attached to a node for installing the operating system

Expanding System Disk Capacity

Data disk

A disk that must be attached to a node for the container engine and kubelet

Container storage

Pod container space

The base size of a container, which is, the upper limit of the disk space occupied by each pod (including the storage space occupied by container images)

Expanding the Capacity of a Data Disk Used by Pod (basesize)

PVC

Storage resources mounted to the containers

Expanding a PVC

Expanding System Disk Capacity

EulerOS 2.9 is used as the sample OS. There is only one partition (/dev/vda1) with a capacity of 50 GiB in the system disk /dev/vda, and then 50 GiB is added to the system disk. In this example, the additional 50 GiB is allocated to the existing /dev/vda1 partition.

  1. Expand the capacity of the system disk on the EVS console.
  2. Log in to the node and run the growpart command to check whether growpart has been installed.

    If the tool operation guide is displayed, the growpart has been installed. Otherwise, run the following command to install growpart:

    yum install cloud-utils-growpart

  3. Run the following command to view the total capacity of the system disk /dev/vda:

    fdisk -l

    If the following information is displayed, the total capacity of /dev/vda is 100 GiB.

    [root@test-48162 ~]# fdisk -l
    Disk /dev/vda: 100 GiB, 107374182400 bytes, 209715200 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x78d88f0b
    
    Device     Boot Start       End   Sectors Size Id Type
    /dev/vda1  *     2048 104857566 104855519  50G 83 Linux
    
    Disk /dev/vdb: 100 GiB, 107374182400 bytes, 209715200 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    
    Disk /dev/mapper/vgpaas-dockersys: 90 GiB, 96632569856 bytes, 188735488 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    
    Disk /dev/mapper/vgpaas-kubernetes: 10 GiB, 10733223936 bytes, 20963328 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes

  4. Run the following command to check the capacity of the system disk partition /dev/vda1:

    df -TH

    Information similar to the following is displayed:

    [root@test-48162 ~]# df -TH
    Filesystem                    Type      Size  Used Avail Use% Mounted on
    devtmpfs                      devtmpfs  1.8G     0  1.8G   0% /dev
    tmpfs                         tmpfs     1.8G     0  1.8G   0% /dev/shm
    tmpfs                         tmpfs     1.8G   13M  1.8G   1% /run
    tmpfs                         tmpfs     1.8G     0  1.8G   0% /sys/fs/cgroup
    /dev/vda1                     ext4      53G  3.3G   47G   7% /
    tmpfs                         tmpfs     1.8G   75M  1.8G   5% /tmp
    /dev/mapper/vgpaas-dockersys  ext4       95G  1.3G   89G   2% /var/lib/docker
    /dev/mapper/vgpaas-kubernetes ext4       11G   39M   10G   1% /mnt/paas/kubernetes/kubelet
    ...

  5. Run the following command to extend the partition using growpart:

    growpart System disk Partition number

    The partition number is 1 because there is only one /dev/vda1 partition in the system disk, as shown in the following command:

    growpart /dev/vda 1

    Information similar to the following is displayed:

    CHANGED: partition=1 start=2048 old: size=104855519 end=104857567 new: size=209713119 end=209715167

  6. Run the following command to extend the file system:

    resize2fs Disk partition

    An example command is as follows:

    resize2fs /dev/vda1

    Information similar to the following is displayed:

    resize2fs 1.45.6 (20-Mar-2020)
    Filesystem at /dev/vda1 is mounted on /; on-line resizing required
    old_desc_blocks = 7, new_desc_blocks = 13
    The filesystem on /dev/vda1 is now 26214139 (4k) blocks long.

  7. Run the following command to view the new capacity of the /dev/vda1 partition:

    df -TH

    Information similar to the following is displayed:

    [root@test-48162 ~]# df -TH
    Filesystem                    Type      Size  Used Avail Use% Mounted on
    devtmpfs                      devtmpfs  1.8G     0  1.8G   0% /dev
    tmpfs                         tmpfs     1.8G     0  1.8G   0% /dev/shm
    tmpfs                         tmpfs     1.8G   13M  1.8G   1% /run
    tmpfs                         tmpfs     1.8G     0  1.8G   0% /sys/fs/cgroup
    /dev/vda1                     ext4     106G  3.3G   98G   4% /
    tmpfs                         tmpfs     1.8G   75M  1.8G   5% /tmp
    /dev/mapper/vgpaas-dockersys  ext4       95G  1.3G   89G   2% /var/lib/docker
    /dev/mapper/vgpaas-kubernetes ext4       11G   39M   10G   1% /mnt/paas/kubernetes/kubelet
    ...

  8. Log in to the CCE console and click the cluster. In the navigation pane, choose Nodes. Click More > Sync Server Data in the row containing the target node.

Expanding the Capacity of a Data Disk Used by Container Engines

CCE divides the data disk space for two parts by default. One part is used to store the Docker/containerd working directories, container images, and image metadata. The other is reserved for kubelet and emptyDir volumes. The available container engine space affects image pulls and container startup and running. This section uses Docker as an example to describe how to expand the container engine capacity.

  1. Expand the capacity of the data disk on the EVS console.
  2. Log in to the CCE console and click the cluster. In the navigation pane, choose Nodes. Click More > Sync Server Data in the row containing the target node.
  3. Log in to the target node.
  4. Run the lsblk command to check the block device information of the node.

    A data disk is divided depending on the container storage Rootfs:

    • Overlayfs: No independent thin pool is allocated. Image data is stored in the dockersys disk.
      # lsblk
      NAME                MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
      sda                   8:0    0   50G  0 disk 
      └─sda1                8:1    0   50G  0 part /
      sdb                   8:16   0  200G  0 disk 
      ├─vgpaas-dockersys  253:0    0   90G  0 lvm  /var/lib/docker               # Space used by the container engine
      └─vgpaas-kubernetes 253:1    0   10G  0 lvm  /mnt/paas/kubernetes/kubelet  # Space used by Kubernetes

      Run the following commands on the node to add the new disk capacity to the dockersys disk:

      pvresize /dev/sdb 
      lvextend -l+100%FREE -n vgpaas/dockersys
      resize2fs /dev/vgpaas/dockersys
    • Devicemapper: A thin pool is allocated to store image data.
      # lsblk
      NAME                                MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
      sda                                   8:0    0   50G  0 disk 
      └─sda1                                8:1    0   50G  0 part /
      sdb                                   8:16   0  200G  0 disk 
      ├─vgpaas-dockersys                  253:0    0   18G  0 lvm  /var/lib/docker    
      ├─vgpaas-thinpool_tmeta             253:1    0    3G  0 lvm                   
      │ └─vgpaas-thinpool                 253:3    0   67G  0 lvm                   # Thin pool space.
      │   ...
      ├─vgpaas-thinpool_tdata             253:2    0   67G  0 lvm  
      │ └─vgpaas-thinpool                 253:3    0   67G  0 lvm  
      │   ...
      └─vgpaas-kubernetes                 253:4    0   10G  0 lvm  /mnt/paas/kubernetes/kubelet
      • Run the following commands on the node to add the new disk capacity to the thinpool disk:
        pvresize /dev/sdb 
        lvextend -l+100%FREE -n vgpaas/thinpool
      • Run the following commands on the node to add the new disk capacity to the dockersys disk:
        pvresize /dev/sdb 
        lvextend -l+100%FREE -n vgpaas/dockersys
        resize2fs /dev/vgpaas/dockersys

Expanding the Capacity of a Data Disk Used by kubelet

CCE divides the data disk space for two parts by default. One part is used to store the Docker/containerd working directories, container images, and image metadata. The other is reserved for kubelet and emptyDir volumes. To expand the kubelet space, perform the following steps:

  1. Expand the capacity of the data disk on the EVS console.
  2. Log in to the CCE console and click the cluster. In the navigation pane, choose Nodes. Click More > Sync Server Data in the row containing the target node.
  3. Log in to the target node.
  4. Run the following commands on the node to add the new disk capacity to the Kubernetes disk:

    pvresize /dev/sdb
    lvextend -l+100%FREE -n vgpaas/kubernetes
    resize2fs /dev/vgpaas/kubernetes

Expanding the Capacity of a Data Disk Used by Pod (basesize)

  1. Log in to the CCE console and click the name of the target cluster in the cluster list.
  2. Choose Nodes from the navigation pane.
  3. Select the target node and choose More > Reset Node in the Operation column.

    Resetting a node may make the node-specific resources (such as local storage and workloads scheduled to this node) unavailable. Exercise caution when performing this operation to avoid impact on running services.

  4. Reconfigure node parameters.

    If you need to adjust the container storage space, pay attention to the following configurations:

    Storage Settings: Click Expand next to the data disk to set the following parameters:
    • Allocate Disk Space: storage space used by the container engine to store the Docker/containerd working directory, container image data, and image metadata. Defaults to 90% of the data disk.
    • Allocate Pod Basesize: CCE allows you to set an upper limit for the disk space occupied by each workload pod (including the space occupied by container images). This setting prevents the pods from taking all the disk space available, which may cause service exceptions. It is recommended that the value be less than or equal to 80% of the container engine space.
      • The capability of customizing pod basesize is related to the node OS and container storage rootfs.
        • When the rootfs uses Device Mapper, the node supports custom pod basesize. The default storage space of a single container is 10 GiB.
        • When the rootfs uses OverlayFS, most nodes do not support custom pod basesize. The storage space of a single container is not limited and defaults to the container engine space.

          Only nodes running EulerOS 2.9 in clusters of 1.19.16, 1.21.3, 1.23.3, and later versions support custom pod basesize.

      • In the case of using Docker on nodes running EulerOS 2.9, basesize will not take effect if CAP_SYS_RESOURCE or privileged is configured for a container.

  5. After the node is reset, log in to the node and run the following command to access the container and check whether the container storage capacity has been expanded.

    docker exec -it container_id /bin/sh or kubectl exec -it container_id /bin/sh

    df -h

Expanding a PVC

Cloud storage:

  • OBS and SFS: There is no storage restriction and capacity expansion is not required.
  • EVS:
    • You can expand the capacity of automatically created pay-per-use volumes on the console. The procedure is as follows:
      1. Choose Storage in the navigation pane and click the PersistentVolumeClaims (PVCs) tab. Locate the row containing the target PVC and choose More > Scale-out in the Operation column.
      2. Enter the capacity to be added and click OK.
  • For SFS Turbo, expand the capacity on the SFS console and then change the capacity in the PVC.