Using an Existing SFS File System Through a Static PV
SFS is a network-attached storage (NAS) that provides shared, scalable, and high-performance file storage. It applies to large-capacity expansion and cost-sensitive services. This section describes how to use an existing SFS file system to statically create PVs and PVCs for data persistence and sharing in workloads.
Prerequisites
- You have created a cluster and installed the CCE Container Storage (Everest) add-on in the cluster.
- To create a cluster using commands, ensure kubectl is used. For details, see Connecting to a Cluster Using kubectl.
- You have created an SFS file system that is in the same VPC as the cluster.
- Before using SFS 3.0 for storage, ensure a VPC endpoint has been created in the VPC where the cluster is located for the cluster to access the SFS 3.0 file system. For details, see Configuring a VPC Endpoint.
Notes and Constraints
- Multiple PVs can use the same SFS or SFS Turbo file system with the following restrictions:
- Do not mount the PVCs/PVs that use the same underlying SFS or SFS Turbo volume to one pod. This will lead to a pod startup failure because not all PVCs can be mounted to the pod due to the same volumeHandle value.
- The persistentVolumeReclaimPolicy parameter in the PVs must be set to Retain. Otherwise, when a PV is deleted, the associated underlying volume may be deleted. In this case, other PVs associated with the underlying volume malfunction.
- When the underlying volume is repeatedly used, enable isolation and protection for ReadWriteMany at the application layer to prevent data overwriting and loss.
- If SFS 3.0 is used, the Everest add-on of v2.0.9 or later must be installed in the cluster.
- If SFS 3.0 is used, the owner group and permission of the mount point cannot be modified. The default owner of the mount point is user root.
- If SFS 3.0 is used, there may be a latency during the creation or deletion of PVCs and PVs. The billing duration is determined by the time when the SFS system is created or deleted on the SFS console.
- If the reclamation policy of SFS 3.0 is set to Delete, PVs and PVCs can be properly deleted only after all files are manually deleted from the mounted SFS system.
Using an Existing SFS File System on the Console
- Log in to the CCE console and click the cluster name to access the cluster console.
- Statically create a PVC and PV.
- Choose Storage in the navigation pane. In the right pane, click the PVCs tab. Click Create PVC in the upper right corner. In the dialog box displayed, configure PVC parameters.
Parameter
Description
PVC Type
In this example, select SFS.
PVC Name
Enter the PVC name, which must be unique in a namespace.
Creation Method
- If underlying storage is available, create a PV or use an existing PV to statically create a PVC.
- If no underlying storage is available, select Dynamically provision. For details, see Using an SFS File System Through a Dynamic PV.
In this example, select Create new to create both a PV and PVC on the console.
PVa
Select an existing PV in the cluster. For details about how to create a PV, see "Creating a storage volume" in Related Operations.
You do not need to specify this parameter in this example.
SFSb
Click Select SFS. On the displayed page, select the SFS file system that meets your requirements and click OK.
NOTE:Only SFS 3.0 is supported.
Subdirectoryb
Determine whether to use subdirectories to create PVs. Enter the absolute path of a subdirectory, for example, /a/b. Ensure that the subdirectory is available.
PV Nameb
Enter the PV name, which must be unique in the same cluster.
Access Modeb
SFS volumes support only ReadWriteMany, indicating that a storage volume can be mounted to multiple nodes in read/write mode. For details, see Volume Access Modes.
Reclaim Policyb
You can select Delete or Retain to specify the reclaim policy of the underlying storage when the PVC is deleted. For details, see PV Reclaim Policy.
NOTE:If multiple PVs use the same underlying storage volume, use Retain to prevent the underlying volume from being deleted with a PV.
Subdirectory Reclaim Policyb
Determine whether to retain subdirectories when a PVC is deleted. This parameter must be used with PV Reclaim Policy and can be configured when PVs are created using subdirectories and PV Reclaim Policy is set to Delete.
- Retain: If a PVC is deleted, the PV will be deleted, but the subdirectories associated with the PV will be retained.
- Delete: After a PVC is deleted, the PV and its associated subdirectories will also be deleted.
Mount Optionsb
Enter the mounting parameter key-value pairs. For details, see Configuring SFS Volume Mount Options.
a: The parameter is available when Creation Method is set to Use existing.
b: The parameter is available when Creation Method is set to Create new.
- Click Create to create a PVC and a PV.
You can choose Storage in the navigation pane and view the created PVC and PV on the PVCs and PVs tab pages, respectively.
- Choose Storage in the navigation pane. In the right pane, click the PVCs tab. Click Create PVC in the upper right corner. In the dialog box displayed, configure PVC parameters.
- Create an application.
- Choose Workloads in the navigation pane. In the right pane, click the Deployments tab.
- Click Create Workload in the upper right corner. On the displayed page, click Data Storage in the Container Settings area and click Add Volume to select PVC.
Mount and use storage volumes, as shown in Table 1. For details about other parameters, see Workloads.
Table 1 Mounting a storage volume Parameter
Description
PVC
Select an existing SFS volume.
Mount Path
Enter a mount path, for example, /tmp.
This parameter specifies a container path to which a data volume will be mounted. Do not mount the volume to a system directory such as / or /var/run. This may lead to container errors. Mount the volume to an empty directory. If the directory is not empty, ensure that there are no files that affect container startup. Otherwise, the files will be replaced, leading to container startup failures or workload creation failures.NOTICE:If a volume is mounted to a high-risk directory, use an account with minimum permissions to start the container. Otherwise, high-risk files on the host may be damaged.
Subpath
Enter the subpath of the storage volume and mount a path in the storage volume to the container. In this way, different folders of the same storage volume can be used in a single pod. tmp, for example, indicates that data in the mount path of the container is stored in the tmp folder of the storage volume. If this parameter is left blank, the root path will be used by default.
Permission
- Read-only: You can only read the data in the mounted volumes.
- Read-write: You can modify the data volumes mounted to the path. Newly written data will not be migrated if the container is migrated, which may cause data loss.
In this example, the disk is mounted to the /data path of the container. The container data generated in this path is stored in the SFS file system.
- After the configuration, click Create Workload.
After the workload is created, the data in the container mount directory will be persistently stored. Verify the storage by referring to Verifying Data Persistence and Sharing.
Using an Existing SFS File System Through kubectl
You can select a mode that meets the requirements of your service.
- Use kubectl to access the cluster.
- Create a PV.
- Create the pv-sfs.yaml file.
Example:
apiVersion: v1 kind: PersistentVolume metadata: annotations: pv.kubernetes.io/provisioned-by: everest-csi-provisioner everest.io/reclaim-policy: retain-volume-only # (Optional) The underlying volume is retained when the PV is deleted. name: pv-sfs # PV name spec: accessModes: - ReadWriteMany # Access mode. The value must be ReadWriteMany for SFS. capacity: storage: 1Gi # SFS volume capacity csi: driver: nas.csi.everest.io # Dependent storage driver for the mounting fsType: nfs volumeHandle: <sfs30_name> # Enter the file system name when SFS 3.0 is used. volumeAttributes: everest.io/share-export-location: <your_location> # Shared path of the SFS volume storage.kubernetes.io/csiProvisionerIdentity: everest-csi-provisioner everest.io/sfs-version: sfs3.0 # SFS 3.0 is used. persistentVolumeReclaimPolicy: Retain # Reclaim policy storageClassName: csi-sfs # StorageClass name, where csi-sfs indicates SFS 3.0 mountOptions: [] # Mount options
Table 2 Key parameters Parameter
Mandatory
Description
everest.io/reclaim-policy
No
Only retain-volume-only is supported.
This parameter is valid only when the Everest version is 1.2.9 or later and the reclaim policy is Delete. If the reclaim policy is Delete and the current value is retain-volume-only, the associated PV is deleted while the underlying storage volume is retained, when a PVC is deleted.
volumeHandle
Yes
If SFS 3.0 is used, enter the name of the file system.
everest.io/share-export-location
Yes
Shared path of SFS 3.0.
A shared path is in the following format:
{your_sfs30_name}.sfs3.{region}.myhuaweicloud.com:/{your_sfs30_name}
mountOptions
Yes
Mount options.
If not specified, the following configurations are used by default. For details, see Configuring SFS Volume Mount Options.
mountOptions: - vers=3 - timeo=600 - nolock - hard
persistentVolumeReclaimPolicy
Yes
A reclaim policy is supported when the cluster version is or later than 1.19.10 and the Everest version is or later than 1.2.9.
The Delete and Retain reclaim policies are supported. For details, see PV Reclaim Policy. If multiple PVs use the same SFS volume, use Retain to prevent the underlying volume from being deleted with a PV.
Retain: When a PVC is deleted, both the PV and underlying storage resources will be retained. You need to manually delete these resources. After the PVC is deleted, the PV is in the Released state and cannot be bound to a PVC again.
Delete: When a PVC is deleted, its PV will also be deleted.
storage
Yes
Requested capacity in the PVC, in Gi.
For SFS, this field is used only for verification (cannot be empty or 0). Its value is fixed at 1, and any value you set does not take effect for SFS file systems.
storageClassName
Yes
StorageClass name. Enter csi-sfs, indicating that SFS 3.0 is used.
- Run the following command to create a PV:
kubectl apply -f pv-sfs.yaml
- Create the pv-sfs.yaml file.
- Create a PVC.
- Create the pvc-sfs.yaml file.
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-sfs namespace: default annotations: volume.beta.kubernetes.io/storage-provisioner: everest-csi-provisioner spec: accessModes: - ReadWriteMany # The value must be ReadWriteMany for SFS. resources: requests: storage: 1Gi # SFS volume capacity storageClassName: csi-sfs # StorageClass name, which must be the same as that of the PV volumeName: pv-sfs # PV name
Table 3 Key parameters Parameter
Mandatory
Description
storage
Yes
Requested capacity in the PVC, in Gi.
The value must be the same as the storage size of the existing PV.
storageClassName
Yes
StorageClass name. Enter csi-sfs, indicating that SFS 3.0 is used. The value of this parameter must be the sames as the PV StorageClass specified in 1.
volumeName
Yes
PV name, which must be the same as the PV name in 1.
- Run the following command to create a PVC:
kubectl apply -f pvc-sfs.yaml
- Create the pvc-sfs.yaml file.
- Create an application.
- Create a file named web-demo.yaml. In this example, the SFS volume is mounted to the /data path.
apiVersion: apps/v1 kind: Deployment metadata: name: web-demo namespace: default spec: replicas: 2 selector: matchLabels: app: web-demo template: metadata: labels: app: web-demo spec: containers: - name: container-1 image: nginx:latest volumeMounts: - name: pvc-sfs-volume # Volume name, which must be the same as the volume name in the volumes field mountPath: /data # Location where the storage volume is mounted imagePullSecrets: - name: default-secret volumes: - name: pvc-sfs-volume # Volume name, which can be customized persistentVolumeClaim: claimName: pvc-sfs # Name of the created PVC
- Run the following command to create a workload to which the SFS volume is mounted:
kubectl apply -f web-demo.yaml
After the workload is created, the data in the container mount directory will be persistently stored. Verify the storage by referring to Verifying Data Persistence and Sharing.
- Create a file named web-demo.yaml. In this example, the SFS volume is mounted to the /data path.
- Use kubectl to access the cluster.
- Create a PV.
- Create the pv-sfs.yaml file.
Example:
apiVersion: v1 kind: PersistentVolume metadata: annotations: pv.kubernetes.io/provisioned-by: everest-csi-provisioner name: pv-sfs # PV name spec: accessModes: - ReadWriteMany # Access mode. The value must be ReadWriteMany for SFS. capacity: storage: 1Gi # SFS volume capacity csi: driver: nas.csi.everest.io # Dependent storage driver for the mounting fsType: nfs volumeHandle: pv-sfs # Enter the PV name when using a subdirectory. volumeAttributes: everest.io/share-export-location: <your_location> # Shared path of the SFS volume storage.kubernetes.io/csiProvisionerIdentity: everest-csi-provisioner everest.io/sfs-version: sfs3.0 # SFS 3.0 is used. everest.io/csi.volume-as: absolute-path # An SFS subdirectory is used. everest.io/csi.path: /a # An automatically created subdirectory, which must be an absolute path everest.io/csi.sfs30-name: <sfs_name> # SFS instance name. This parameter is available only when subdirectories are used. everest.io/csi.reclaim-policy: retain-volume-only # When a PVC is deleted, the PV will be deleted but the subdirectories associated with the PV will be retained. This parameter is available only when subdirectories are used and the reclaim policy is Delete. persistentVolumeReclaimPolicy: Retain # Reclaim policy storageClassName: csi-sfs # StorageClass name, where csi-sfs indicates SFS 3.0 mountOptions: [] # Mount options
Table 4 Key parameters Parameter
Mandatory
Description
volumeHandle
Yes
PV name when an SFS subdirectory is used.
everest.io/share-export-location
Yes
Shared path of SFS 3.0.
A shared path is in the following format:
{your_sfs30_name}.sfs3.{region}.myhuaweicloud.com:/{your_sfs30_name}/{absolute_path}
mountOptions
Yes
Mount options.
If not specified, the following configurations are used by default. For details, see Configuring SFS Volume Mount Options.
mountOptions: - vers=3 - timeo=600 - nolock - hard
persistentVolumeReclaimPolicy
Yes
A reclaim policy is supported when the cluster version is or later than 1.19.10 and the Everest version is or later than 1.2.9.
The Delete and Retain reclaim policies are supported. For details, see PV Reclaim Policy. If multiple PVs use the same SFS volume, use Retain to prevent the underlying volume from being deleted with a PV.
Retain: When a PVC is deleted, both the PV and underlying storage resources will be retained. You need to manually delete these resources. After the PVC is deleted, the PV is in the Released state and cannot be bound to a PVC again.
Delete: When a PVC is deleted, its PV will also be deleted.
everest.io/csi.volume-as
No
The value is fixed at absolute-path, indicating that a dynamically created SFS subdirectory is used.
Ensure Everest of v2.4.41 or later has been installed in the cluster.
everest.io/csi.path
No
Subdirectory that is automatically created, which must be an absolute path.
everest.io/csi.sfs30-name
No
An SFS instance name. This parameter is used only when an SFS subdirectory is dynamically created.
everest.io/csi.reclaim-policy
No
Whether to retain the subdirectory when deleting a PVC. Use this parameter only when creating a dynamic SFS subdirectory. This parameter must be used with PV Reclaim Policy. This parameter is available only when the PV reclaim policy is Delete. Options:
- retain-volume-only: If a PVC is deleted, the PV will be deleted, but the subdirectories associated with the PV will be retained.
- delete: After a PVC is deleted, the PV and its associated subdirectories will also be deleted.
NOTE:
When a subdirectory is deleted, only the absolute path of the subdirectory configured in the PVC will be deleted. The upper-layer directory will not be deleted.
storage
Yes
Requested capacity in the PVC, in Gi.
For SFS, this field is used only for verification (cannot be empty or 0). Its value is fixed at 1, and any value you set does not take effect for SFS file systems.
storageClassName
Yes
StorageClass name. Enter csi-sfs, indicating that SFS 3.0 is used.
- Run the following command to create a PV:
kubectl apply -f pv-sfs.yaml
- Create the pv-sfs.yaml file.
- Create a PVC.
- Create the pvc-sfs.yaml file.
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-sfs namespace: default annotations: volume.beta.kubernetes.io/storage-provisioner: everest-csi-provisioner everest.io/csi.volume-as: absolute-path # (Optional) An SFS subdirectory is used. everest.io/csi.path: /a # An automatically created subdirectory, which must be an absolute path everest.io/csi.sfs30-name: <sfs_name> # SFS instance name. This parameter is available only when subdirectories are used. everest.io/csi.reclaim-policy: retain-volume-only spec: accessModes: - ReadWriteMany # The value must be ReadWriteMany for SFS. resources: requests: storage: 1Gi # SFS volume capacity storageClassName: csi-sfs # StorageClass name, which must be the same as that of the PV volumeName: pv-sfs # PV name
Table 5 Key parameters Parameter
Mandatory
Description
everest.io/csi.volume-as
Yes
The value is fixed at absolute-path, indicating that a dynamically created SFS subdirectory is used.
Ensure Everest of v2.4.41 or later has been installed in the cluster.
everest.io/csi.path
Yes
Subdirectory that is automatically created, which must be an absolute path.
everest.io/csi.sfs30-name
Yes
An SFS instance name. This parameter is used only when an SFS subdirectory is dynamically created.
everest.io/csi.reclaim-policy
Yes
Whether to retain the subdirectory when deleting a PVC. Use this parameter only when creating a dynamic SFS subdirectory. This parameter must be used with PV Reclaim Policy. This parameter is available only when the PV reclaim policy is Delete. Options:
- retain-volume-only: If a PVC is deleted, the PV will be deleted, but the subdirectories associated with the PV will be retained.
- delete: After a PVC is deleted, the PV and its associated subdirectories will also be deleted.
NOTE:
When a subdirectory is deleted, only the absolute path of the subdirectory configured in the PVC will be deleted. The upper-layer directory will not be deleted.
storage
Yes
Requested capacity in the PVC, in Gi.
The value must be the same as the storage size of the existing PV.
storageClassName
Yes
StorageClass name. Enter csi-sfs, indicating that SFS 3.0 is used. The value of this parameter must be the sames as the PV StorageClass specified in 1.
volumeName
Yes
PV name, which must be the same as the PV name in 1.
- Run the following command to create a PVC:
kubectl apply -f pvc-sfs.yaml
- Create the pvc-sfs.yaml file.
- Create an application.
- Create a file named web-demo.yaml. In this example, the SFS volume is mounted to the /data path.
apiVersion: apps/v1 kind: Deployment metadata: name: web-demo namespace: default spec: replicas: 2 selector: matchLabels: app: web-demo template: metadata: labels: app: web-demo spec: containers: - name: container-1 image: nginx:latest volumeMounts: - name: pvc-sfs-volume # Volume name, which must be the same as the volume name in the volumes field mountPath: /data # Location where the storage volume is mounted imagePullSecrets: - name: default-secret volumes: - name: pvc-sfs-volume # Volume name, which can be customized persistentVolumeClaim: claimName: pvc-sfs # Name of the created PVC
- Run the following command to create a workload to which the SFS volume is mounted:
kubectl apply -f web-demo.yaml
After the workload is created, the data in the container mount directory will be persistently stored. Verify the storage by referring to Verifying Data Persistence and Sharing.
- Create a file named web-demo.yaml. In this example, the SFS volume is mounted to the /data path.
- Use kubectl to access the cluster.
- Create a PV.
- Create the pv-sfs.yaml file.
Example:
apiVersion: v1 kind: PersistentVolume metadata: annotations: pv.kubernetes.io/provisioned-by: everest-csi-provisioner everest.io/reclaim-policy: retain-volume-only # (Optional) The underlying volume is retained when the PV is deleted. name: pv-sfs # PV name spec: accessModes: - ReadWriteMany # Access mode. The value must be ReadWriteMany for SFS. capacity: storage: 1Gi # SFS volume capacity csi: driver: nas.csi.everest.io # Dependent storage driver for the mounting fsType: nfs volumeHandle: <your_volume_id> # SFS Capacity-Oriented volume ID volumeAttributes: everest.io/share-export-location: <your_location> # Shared path of the SFS volume storage.kubernetes.io/csiProvisionerIdentity: everest-csi-provisioner persistentVolumeReclaimPolicy: Retain # Reclaim policy storageClassName: csi-nas # StorageClass name. csi-nas indicates that SFS Capacity-Oriented is used. mountOptions: [] # Mount options
Table 6 Key parameters Parameter
Mandatory
Description
everest.io/reclaim-policy
No
Only retain-volume-only is supported.
This parameter is valid only when the Everest version is 1.2.9 or later and the reclaim policy is Delete. If the reclaim policy is Delete and the current value is retain-volume-only, the associated PV is deleted while the underlying storage volume is retained, when a PVC is deleted.
volumeHandle
Yes
Volume ID if SFS Capacity-Oriented is used.
Log in to the CCE console, choose Service List > Storage > Scalable File Service, and select SFS Capacity-Oriented. In the list, click the name of the target SFS file system. On the details page, copy the content following ID.
everest.io/share-export-location
Yes
Shared path of the file system.
On the management console, choose Service List > Storage > Scalable File Service. You can obtain the shared path of the file system from the Mount Address column.
mountOptions
Yes
Mount options.
If not specified, the following configurations are used by default. For details, see Configuring SFS Volume Mount Options.
mountOptions: - vers=3 - timeo=600 - nolock - hard
persistentVolumeReclaimPolicy
Yes
A reclaim policy is supported when the cluster version is or later than 1.19.10 and the Everest version is or later than 1.2.9.
The Delete and Retain reclaim policies are supported. For details, see PV Reclaim Policy. If multiple PVs use the same SFS volume, use Retain to prevent the underlying volume from being deleted with a PV.
Retain: When a PVC is deleted, both the PV and underlying storage resources will be retained. You need to manually delete these resources. After the PVC is deleted, the PV is in the Released state and cannot be bound to a PVC again.
Delete: When a PVC is deleted, its PV will also be deleted.
storage
Yes
Requested capacity in the PVC, in Gi.
For SFS, this field is used only for verification (cannot be empty or 0). Its value is fixed at 1, and any value you set does not take effect for SFS file systems.
storageClassName
Yes
StorageClass name csi-nas, indicating that SFS 1.0 Capacity-Oriented is used for storage.
- Run the following command to create a PV:
kubectl apply -f pv-sfs.yaml
- Create the pv-sfs.yaml file.
- Create a PVC.
- Create the pvc-sfs.yaml file.
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-sfs namespace: default annotations: volume.beta.kubernetes.io/storage-provisioner: everest-csi-provisioner spec: accessModes: - ReadWriteMany # The value must be ReadWriteMany for SFS. resources: requests: storage: 1Gi # SFS volume capacity storageClassName: csi-nas # StorageClass name, which must be the same as that of the PV volumeName: pv-sfs # PV name
Table 7 Key parameters Parameter
Mandatory
Description
storage
Yes
Requested capacity in the PVC, in Gi.
The value must be the same as the storage size of the existing PV.
storageClassName
Yes
StorageClass name csi-nas, which must be the same as the StorageClass of the PV specified in 1. This indicates that SFS 1.0 Capacity-Oriented is used for storage.
volumeName
Yes
PV name, which must be the same as the PV name in 1.
- Run the following command to create a PVC:
kubectl apply -f pvc-sfs.yaml
- Create the pvc-sfs.yaml file.
- Create an application.
- Create a file named web-demo.yaml. In this example, the SFS volume is mounted to the /data path.
apiVersion: apps/v1 kind: Deployment metadata: name: web-demo namespace: default spec: replicas: 2 selector: matchLabels: app: web-demo template: metadata: labels: app: web-demo spec: containers: - name: container-1 image: nginx:latest volumeMounts: - name: pvc-sfs-volume # Volume name, which must be the same as the volume name in the volumes field mountPath: /data # Location where the storage volume is mounted imagePullSecrets: - name: default-secret volumes: - name: pvc-sfs-volume # Volume name, which can be customized persistentVolumeClaim: claimName: pvc-sfs # Name of the created PVC
- Run the following command to create a workload to which the SFS volume is mounted:
kubectl apply -f web-demo.yaml
After the workload is created, the data in the container mount directory will be persistently stored. Verify the storage by referring to Verifying Data Persistence and Sharing.
- Create a file named web-demo.yaml. In this example, the SFS volume is mounted to the /data path.
Verifying Data Persistence and Sharing
- View the deployed application and files.
- Run the following command to view the created pod:
kubectl get pod | grep web-demo
Expected output:web-demo-846b489584-mjhm9 1/1 Running 0 46s web-demo-846b489584-wvv5s 1/1 Running 0 46s
- Run the following commands in sequence to view the files in the /data path of the pods:
kubectl exec web-demo-846b489584-mjhm9 -- ls /data kubectl exec web-demo-846b489584-wvv5s -- ls /data
If no result is returned for both pods, no file exists in the /data path.
- Run the following command to view the created pod:
- Run the following command to create a file named static in the /data path:
kubectl exec web-demo-846b489584-mjhm9 -- touch /data/static
- Run the following command to check the files in the /data path:
kubectl exec web-demo-846b489584-mjhm9 -- ls /data
Expected output:
static
- Verify data persistence.
- Run the following command to delete the pod named web-demo-846b489584-mjhm9:
kubectl delete pod web-demo-846b489584-mjhm9
Expected output:
pod "web-demo-846b489584-mjhm9" deleted
After the deletion, the Deployment controller automatically creates a replica.
- Run the following command to view the created pod:
kubectl get pod | grep web-demo
The expected output is as follows, in which web-demo-846b489584-d4d4j is the newly created pod:web-demo-846b489584-d4d4j 1/1 Running 0 110s web-demo-846b489584-wvv5s 1/1 Running 0 7m50s
- Run the following command to check whether the files in the /data path of the new pod have been modified:
kubectl exec web-demo-846b489584-d4d4j -- ls /data
Expected output:
static
The static file is retained, indicating that the data in the file system can be stored persistently.
- Run the following command to delete the pod named web-demo-846b489584-mjhm9:
- Verify data sharing.
- Run the following command to view the created pod:
kubectl get pod | grep web-demo
Expected output:web-demo-846b489584-d4d4j 1/1 Running 0 7m web-demo-846b489584-wvv5s 1/1 Running 0 13m
- Run the following command to create a file named share in the /data path of either pod: In this example, select the pod named web-demo-846b489584-d4d4j.
kubectl exec web-demo-846b489584-d4d4j -- touch /data/share
Check the files in the /data path of the pod.kubectl exec web-demo-846b489584-d4d4j -- ls /data
Expected output:
share static
- Check whether the share file exists in the /data path of another pod (web-demo-846b489584-wvv5s) as well to verify data sharing.
kubectl exec web-demo-846b489584-wvv5s -- ls /data
Expected output:
share static
After you create a file in the /data path of a pod, if the file is also created in the /data path of the other pod, the two pods share the same volume.
- Run the following command to view the created pod:
Related Operations
Operation |
Description |
Procedure |
---|---|---|
Creating a storage volume (PV) |
Create a PV on the CCE console. |
|
Viewing events |
View event names, event types, number of occurrences, Kubernetes events, first occurrence time, and last occurrence time of the PVC or PV. |
|
Viewing a YAML file |
View, copy, or download the YAML file of a PVC or PV. |
|
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot