FSX is a client used to access the high-availability POSIX-compliant file system of TOS. Through this client, TOS buckets can be mounted to a Linux system, enabling the buckets to function as a local Linux file system for data storage and management. This topic introduces how to use static TOS PersistentVolumes (PVs) through the FSX client.
- The csi-fsx and fsx-service add-ons have been installed and upgraded to the latest version. For details, see Upgrading add-ons.
- AK/SK authentication: You have created the AK/SK, which will be used to mount TOS storage. For information about how to obtain the AK and SK, see Obtaining API access keys. To use a temporary token for authentication, you need to implement the logic for refreshing tokens.
- (Optional) If you perform configuration by using YAML, make sure that the kubectl tool has been installed in the local environment and is connected to the target cluster. For details, see Connecting to a cluster.
- StatefulSets require exclusive access to a volume, and do not support a manually created PVC.
- The FSX client currently supports only the x86_64 architecture. The client is currently not available on Windows and macOS. For details about supported environments, see Supported environments.
- This feature is unavailable in clusters running on Kubernetes v1.20 and earlier.
- If you use clusters running on Kubernetes v1.26.x, you cannot use Secrets whose names contain periods (.). Otherwise, the PV will fail to be created.
Creating through the console
- In the left navigation bar, click Cluster. Click the name of the target cluster to go to the cluster management page.
- In the left navigation bar on the cluster management page, click Storage > PersistentVolume.
- Click Create PersistentVolume to create a TOS PV with the FSX access type.
- Click the name of the target cluster. On the cluster management page, click Storage > PersistentVolumeClaim.
- On the page that appears, click Create PersistentVolumeClaim to configure a TOS PVC.
Step 3: Create an application and mount the PV
After the PV is created, add it to a workload that will use it. Supported workloads include Deployment, StatefulSet, Job, CronJob, and DaemonSet.
You can add a PV to a workload when creating it or updating it. For details, see Workloads. Creating through kubectl
Step 1: (Optional) Create a policy
tip
- If you use the AK and SK of the root user, you can skip this step.
- To dynamically refresh temporary tokens, see the AssumeRole API document.
The following is a JSON example for creating a TOS policy:
Step 2: (Optional) Create a Secret
tip
If IRSA authentication is enabled for the csi-fsx add-on, you can skip this step.
- Create a YAML document for the Secret. The following vke-tos-fsx-secret.yaml file serves as an example:
tip
You can use the echo -n "${ak}" | base64 command to perform Base64 encoding on items such as the AK and SK. Note that you need to replace ${ak} with your actual value. For example, if ${ak} is demo, the encoding command is echo -n "demo" | base64, which produces the encoded result ZGVtbw==.
- Run the following command to create the Secret.
- Create a YAML document for the PV. The following vke-tos-fsx-static-pv.yaml file serves as an example:
- The key parameters are described in the following table.
- Run the following command to create the PV.
- Create a YAML document for the PVC. The following vke-tos-fsx-static-pvc.yaml file serves as an example:
- The key parameters are described in the following table.
- Run the following command to create the PVC.
- Run the following command to view the result of the static association between the PVC and PV.
- If the response is similar to the following one, the binding is successful.
Step 5: Create an application and mount the PV
- Create a YAML document for the Deployment. The following vke-tos-fsx-static-deployment.yaml file serves as an example:
- Run the following command to create the Deployment.
After you create a workload and mount it to a PV as described in the preceding steps, verify whether the TOS volume is mounted and whether shared storage and persistent storage are achieved by using the following methods.
- Run the following command to check whether the PV is mounted to the specified path in the pod.
- The expected response is as follows.
- Check the mount path in the pod to view the data in the PV.
- The expected response is as follows.
- View the PV mount path in the pod again.
- The expected response is as follows. You can see the uploaded file, which indicates that the data volume is mounted and persistent storage is achieved.