このページは、お客様の言語ではご利用いただけません。Huawei Cloudは、より多くの言語バージョンを追加するために懸命に取り組んでいます。ご協力ありがとうございました。

Easily Switch Between Product Types

You can click the drop-down list box to switch between different product types.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Attaching Disks to a Node

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

Challenges

In disk planning and striped logical disk creation, it is difficult for users to flexibly attach and partition disks when creating a node.

During node creation, the storage field selects a data disk based on parameters, such as the disk size and disk type, to prevent failures in node creation, resetting, migration, and management caused by drive letter matching failures. For example, if DockerLVMConfigOverride.diskType in the NodeExtendParam field is set to evs during node creation, C7 nodes will not be created.

Solution

This section provides details about the storage field used in node creation so that you can implement complex disk selection and partitioning by calling the node creation API.

The storage field consists of storageSelectors and storageGroups. The storageSelectors field is responsible for disk selection, and the storageGroups field is responsible for disk processing.

The basic logic for field matching is as follows:

  1. storageSelectors selects an EVS disk or a local disk based on the value of storageType.
    1. Local disks do not support exact match. All local disks will be selected as data disks.
      If some local disks need to be reserved, occupy the disks in the pre-installation script. The script is similar to the following:
      # prepare
      vgName=vg-test
      storageDevice=/dev/vdb
      # vgcreate
      vgcreate ${vgName} ${storageDevice}
    2. EVS disks match the disks created in dataVolumes based on the settings of matchLabels.
  2. Policies have priorities to match matchLabels. The matchLabels policy nearest to storageSelectors has a higher priority and the disk nearest to dataVolumes will be preferentially matches. As matchLabels uses loose matching, you are advised to place the matchLabels policy with a small matching range on the top. For example:
    1. In step 1, the first disk in dataVolumes is matched by the EVS disk whose size is 100 GiB and storage class is SAS. In step 2, the second disk in dataVolumes is matched by the EVS disk whose size is 100 GiB because the first disk has been selected.
    2. In step 3, two disks in dataVolumes can be matched because volumeType or count is not specified in matchLabels. In this case, no disk is available for matching in step 4.
  3. storageGroups associates with storageSelectors based on selectorName. Finally, two 100 GiB disks are selected. The CCE backend groups the two PVs into a volume group (VG) and divides the VG into two logical volumes (LVs) in the ratio of 9:1. 10% of Kubernetes LVs are partitioned in striped mode. 90% runtime LVs are partitioned in linear mode by default because runtimeConfig is not configured.

Creating a Raw Disk

During node creation on the CCE console, click Add Data Disk. Then, click Expand next to the newly added data disk and select Default. The created disk is a raw disk.

The following figure shows the API calling logic.

  1. The cceUse selector matches a 100 GiB data disk.
  2. The selected disk is managed by CCE and used as a data disk.
  3. The other 100 GiB data disk created in dataVolumes is not selected by any selector and is managed by storageGroups. Therefore, this EVS disk will be attached to the node as a raw disk and will not be initialized.

After the node is created, log in to the node and check whether a 100 GiB disk has been attached but not initialized.

The following is an API example:

{
	"kind": "Node",
	"apiVersion": "v3",
	"metadata": {
		"name": "test-83790"
	},
	"spec": {
		"flavor": "c3.large.2",
		"az": "ap-southeast-1a",
		"os": "EulerOS 2.9",
		"dataVolumes": [
			{
				"size": 100,
				"volumetype": "SAS"
			},
			{
				"size": 100,
				"volumetype": "SAS"
			}
		],
		"billingMode": 0,
		"extendParam": {
			"maxPods": 110
		},
		"nodeNicSpec": {
			"primaryNic": {
				"subnetId": "ca964acf-8468-4735-8229-97940ef6c881"
			}
		},
		"rootVolume": {
			"size": 50,
			"volumetype": "SAS"
		},
		"runtime": {
			"name": "docker"
		},
		"login": {
			"userPassword": {
				"username": "root",
				"password": "******"
			}
		},
		"storage": {
			"storageSelectors": [
				{
					"name": "cceUse",
					"storageType": "evs",
					"matchLabels": {
						"size": "100",
						"volumeType": "SAS",
						"count": "1"
					}
				}
			],
			"storageGroups": [
				{
					"name": "vgpaas",
					"selectorNames": [
						"cceUse"
					],
					"cceManaged": true,
					"virtualSpaces": [
						{
							"name": "runtime",
							"size": "90%"
						},
						{
							"name": "kubernetes",
							"size": "10%"
						}
					]
				}
			]
		},
		"count": 1
	}
}

Attaching a Disk to a Specified Path

During node creation on the CCE console, click Add Data Disk. Then, click Expand next to the newly added data disk, select Mount Disk, and set the mount path. In this case, CCE initializes and attaches the disk by default.

The following figure shows the API calling logic.

  1. The user1 selector selects a 100 GiB data disk.
  2. Create a VG named vguser1 using LVM.
  3. Strip all the space of vguser1 into an LV named user and format the disk in ext4 format. Finally, attach the disk to the /tmp2 directory.

After the node is created, log in to the node and check whether a 100 GiB disk has been attached and managed by LVM.

The following is an API example. There are two data disks. One is used by CCE, and the other is mounted to the /tmp2 directory.

{
	"kind": "Node",
	"apiVersion": "v3",
	"metadata": {
		"name": "test-37106"
	},
	"spec": {
		"flavor": "c3.large.2",
		"az": "ap-southeast-1a",
		"os": "EulerOS 2.9",
		"dataVolumes": [
			{
				"size": 100,
				"volumetype": "SAS"
			},
			{
				"size": 100,
				"volumetype": "SAS"
			}
		],
		"billingMode": 0,
		"extendParam": {
			"maxPods": 110
		},
		"nodeNicSpec": {
			"primaryNic": {
				"subnetId": "ca964acf-8468-4735-8229-97940ef6c881"
			}
		},
		"rootVolume": {
			"size": 50,
			"volumetype": "SAS"
		},
		"runtime": {
			"name": "docker"
		},
		"login": {
			"userPassword": {
				"username": "root",
				"password": "******"
			}
		},
		"storage": {
			"storageSelectors": [
				{
					"name": "cceUse",
					"storageType": "evs",
					"matchLabels": {
						"size": "100",
						"volumeType": "SAS",
						"count": "1"
					}
				},
				{
					"name": "user1",
					"storageType": "evs",
					"matchLabels": {
						"size": "100",
						"volumeType": "SAS",
						"count": "1"
					}
				}
			],
			"storageGroups": [
				{
					"name": "vgpaas",
					"selectorNames": [
						"cceUse"
					],
					"cceManaged": true,
					"virtualSpaces": [
						{
							"name": "runtime",
							"size": "80%"
						},
						{
							"name": "kubernetes",
							"size": "20%"
						}
					]
				},
				{
					"name": "vguser1",
					"selectorNames": [
						"user1"
					],
					"virtualSpaces": [
						{
							"name": "user",
							"size": "100%",
							"lvmConfig": {
								"lvType": "linear",
								"path": "/tmp2"
							}
						}
					]
				}
			]
		},
		"count": 1
	}
}

Creating Striped LVs to Improve Disk Performance

Currently, the striped LV function is supported only by calling an API. The following is an example:

  1. storageSelectors matches all EVS disks in dataVolumes because matchLabels is not contained in storageSelectors.
  2. Create a VG named vgpaas using LVM.
  3. Strip 90% of the vgpaas space into runtime LVs.
  4. Strip 10% of the vgpaas space into Kubernetes LVs.
NOTE:
  • Two or more data disks are required for striping.
  • When creating a striped LV, ensure that the types and sizes of the PVs added to the VG are the same. Otherwise, the creation will fail.
  • When creating a striped LV, use the striping configuration for both the runtime LV and Kubernetes LV. Otherwise, the creation will fail.

Log in to the node and run the following command to view the striping result:

The following is an API example:

{
    "kind": "Node",
    "apiVersion": "v3",
    "metadata": {
        "name": "test-83773"
    },
    "spec": {
        "flavor": "c3.large.2",
        "az": "ap-southeast-1a",
        "os": "EulerOS 2.9",
        "dataVolumes": [
            {
                "size": 100,
                "volumetype": "SAS"
            },
            {
                "size": 100,
                "volumetype": "SAS"
            }
        ],
        "billingMode": 0,
        "extendParam": {
            "maxPods": 110
        },
        "nodeNicSpec": {
            "primaryNic": {
                "subnetId": "ca964acf-8468-4735-8229-97940ef6c881"
            }
        },
        "rootVolume": {
            "size": 50,
            "volumetype": "SAS"
        },
        "runtime": {
            "name": "docker"
        },
        "login": {
            "userPassword": {
                "username": "root",
                "password": "******"
            }
        },
        "storage": {
            "storageSelectors": [
                {
                    "name": "cceUse",
                    "storageType": "evs"
                }
            ],
            "storageGroups": [
                {
                    "name": "vgpaas",
                    "selectorNames": [
                        "cceUse"
                    ],
                    "cceManaged": true,
                    "virtualSpaces": [
                        {
                            "name": "runtime",
                            "size": "90%",
                            "runtimeConfig": {
                                "lvType": "striped"
                            }
                        },
                        {
                            "name": "kubernetes",
                            "size": "10%",
                            "lvmConfig": {
                                "lvType": "striped"
                            }
                        }
                    ]
                }
            ]
        },
        "count": 1
    }
}

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback