Create a data volume in the cluster.

Request information

Request line (RequestLine)

Post/volumes/create HTTP/1.1

Request line parameter (URI Param)


Special request header (RequestHead)

Content-Type: application/json

Request body (RequestBody)

JSON object

    "name": "***",
    "driver": "***",
    "driverOpts": {
       "para1": "value",
       "para2": "value",

Request body explanation

Name  Type  Required Description 
name  string  Yes  The data volume name,  which can be 1–64 characters long, and contain numbers, English letters, and hyphens (-), but cannot start with a hyphen (-).
driver string Yes

The data volume type.  Currently, Container Service supports the ossfs type.

driverOpts DriverOptions Yes

For Object Storage Service (OSS) data volumes, it is OSSOpts.

The definitions of OSSOpts data volume are as follows.


Name  Type  Required Description 
bucket string Yes  The OSS bucket name, which can be obtained in the OSS console.
ak_id string Yes The AccessKey ID 
ak_secret string Yes The AccessKey Secret required to access the OSS resources.
url string Yes The domain name provided by the OSS bucket. You can obtain the domain name in the OSS console.
no_stat_cache string Yes File caching. To synchronize the changes of a file among different machines, disable caching.
other_opts string Yes The configuration parameters for connecting to OSS.

Response information

Response line (ResponseLine)

HTTP/1.1 201 Created

Response body (ResponseBody)

JSON object

"Name": "volume",
"Driver": "***",
"Mountpoint": "/mnt/acs_mnt/**/***",
"Labels": null,
"Scope": ""

Response body explanation

Name  Type  Description 
Name  string The data volume name.
Driver string

The type of the data volume driver: ossfs .

Mountpoint  string  The mount point of the data volume on the host: /mnt/acs_mnt/**/***.
Labels Map [String] string The metadata information of the data volume.
Scope string  The data volume management range. inside the host. global indicates the cluster level. local  indicates inside the host.

OSS data volume example

Request example 

    "name": "ossvolume",    
    "driver": "ossfs",    
    "driverOpts": {
       "bucket": "aliyun-docker",   
       "ak_id": "****", 
       "ak_secret": "*****",  
       "url": "",  
       "no_stat_cache": "true", 
       "other_opts": "-o allow_other -o default_permission=666"

Response example 

    "Name": "ossvolume",
    "Driver": "ossfs",
    "Mountpoint": "/mnt/acs_mnt/ossfs/aliyun-docker",
    "Labels": null,
    "Scope": ""