Reviewed-by: gtema <artem.goncharov@gmail.com> Co-authored-by: Dong, Qiu Jian <qiujiandong1@huawei.com> Co-committed-by: Dong, Qiu Jian <qiujiandong1@huawei.com>
5.3 KiB
(kubectl) Automatically Creating an SFS Volume
Scenario
CCE supports creating SFS volumes through PersistentVolumeClaims (PVCs).
Prerequisites
You have created a CCE cluster and installed the FlexVolume plug-in (storage-driver) in the cluster.
Notes and Constraints
The following configuration example applies to clusters of Kubernetes 1.13 or earlier.
Procedure
- Use kubectl to connect to the cluster. For details, see Connecting to a Cluster Using kubectl.
- Run the following commands to configure the pvc-sfs-auto-example.yaml file, which is used to create a PVC.
touch pvc-sfs-auto-example.yaml
vi pvc-sfs-auto-example.yaml
Example YAML file:apiVersion: v1 kind: PersistentVolumeClaim metadata: annotations: volume.beta.kubernetes.io/storage-class: nfs-rw name: pvc-sfs-auto-example namespace: default spec: accessModes: - ReadWriteMany resources: requests: storage: 10Gi
Table 1 Key parameters Parameter
Description
volume.beta.kubernetes.io/storage-class
File storage class. Currently, the standard file protocol type (nfs-rw) is supported.
name
Name of the PVC to be created.
accessModes
Only ReadWriteMany is supported. ReadWriteOnly is not supported.
storage
Storage capacity in the unit of Gi.
- Run the following command to create the PVC.
kubectl create -f pvc-sfs-auto-example.yaml
After the command is executed, a file system is created in the VPC to which the cluster belongs. Choose Storage > SFS on the CCE console or log in to the SFS console to view the file system.