edit-icon download-icon

Create a data volume

Last Updated: Jan 24, 2018

Description

Create a data volume in the cluster.

Request information

Request line (RequestLine)

  1. POST /volumes/create HTTP/1.1

Request line parameter (URI Param)

None

Special request header (RequestHead)

  1. Content-Type: application/json

Request body (RequestBody)

JSON object

  1. {
  2. "name": "***",
  3. "driver": "***",
  4. "driverOpts": {
  5. "para1": "value",
  6. "para2": "value",
  7. ...
  8. }
  9. }

Request body explanation

Name Type Required? Description
name stringYesThe data volume name, which can be 1–64 characters long, and contain numbers, English letters, and hyphens (-), but cannot start with a hyphen (-).
driver stringYesThe data volume type. Currently, Container Service supports the ossfs type.
driverOpts DriverOptionsYesThe configuration parameter options of data volumes. Different types of data volumes have different parameters. For Object Storage Service (OSS) data volumes, it is OSSOpts.

The definitions of OSSOpts data volume are as follows.

OSSOpts:

Name Type Required? Description
bucketstringYesThe OSS bucket name, which can be obtained in the OSS console.
ak_idstringYesThe AccessKey ID required to access OSS resources.
ak_secretstringYesThe AccessKey Secret required to access the OSS resources.
urlstringYesThe domain name provided by the OSS bucket. You can obtain the domain name in the OSS console.
no_stat_cache stringYesFile caching. To synchronize the changes of a file among different machines, disable caching.
other_optsstringYesThe configuration parameters for connecting to OSS.

Response information

Response line (ResponseLine)

  1. HTTP/1.1 201 Created

Response body (ResponseBody)

JSON object

  1. {
  2. "Name": "volume",
  3. "Driver": "***",
  4. "Mountpoint": "/mnt/acs_mnt/**/***",
  5. "Labels": null,
  6. "Scope": ""
  7. }

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. global indicates the cluster level. local indicates inside the host.

OSS data volume example

Request example

  1. {
  2. "name": "ossvolume",
  3. "driver": "ossfs",
  4. "driverOpts": {
  5. "bucket": "aliyun-docker",
  6. "ak_id": "****",
  7. "ak_secret": "*****",
  8. "url": "oss-cn-hangzhou.aliyuncs.com",
  9. "no_stat_cache": "true",
  10. "other_opts": "-o allow_other -o default_permission=666"
  11. }
  12. }

Return example

  1. {
  2. "Name": "ossvolume",
  3. "Driver": "ossfs",
  4. "Mountpoint": "/mnt/acs_mnt/ossfs/aliyun-docker",
  5. "Labels": null,
  6. "Scope": ""
  7. }
Thank you! We've received your feedback.