tencent cloud

Feedback

Static Mounting of CFS-Turbo for TKE Serverless Clusters

Last updated: 2023-03-14 18:26:30

    Use Cases

    You can mount a CFS Turbo storage for a TKE Serverless. The add-on is used to mount the Tencent Cloud CFS Turbo file system to a workload based on a private protocol. Currently, only static configuration is supported. For more information about CFS storage types, see Storage Types and Performance.

    Prerequisites

    A TKE Serverless of v1.14 or later has been created.

    Directions

    Creating a file system

    Create a CFS Turbo file system. For details, see Creating a File System and Mount Point.
    Note
    After the file system is created, you need to associate the cluster network (vpc-xx) with the CCN instance of the file system. You can check it in the information about file system mount target.

    Deploying a Node Plugin

    Step 1. Create a csidriver.yaml file

    Here is an example of a csidriver.yaml file:
    apiVersion: storage.k8s.io/v1
    kind: CSIDriver
    metadata:
    name: com.tencent.cloud.csi.cfsturbo
    spec:
    attachRequired: false
    podInfoOnMount: false

    Step 2. Create a CSI driver

    Run the following command to create a CSI driver:
    kubectl apply -f csidriver.yaml

    Creating a CFS Turbo volume

    Step 1. Create a CFS Turbo type PV based on the following template

    apiVersion: v1
    kind: PersistentVolume
    metadata:
    name: pv-cfsturbo
    spec:
    accessModes:
    - ReadWriteMany
    capacity:
    storage: 10Gi
    csi:
    driver: com.tencent.cloud.csi.cfsturbo
    volumeHandle: pv-cfsturbo
    volumeAttributes:
    host: *.*.*.*
    fsid: ********
    # cfs turbo subPath
    path: /
    storageClassName: ""
    Parameters:
    metadata.name: The name of the created PV.
    spec.csi.volumeHandle: It must be consistent with the PV name.
    spec.csi.volumeAttributes.host: The IP address of the file system. You can check it in the file system mount target information.
    spec.csi.volumeAttributes.fsid: The fsid of the file system (not the file system ID). You can check it in the file system mount target information. It is the string between tcp0:/ and /cfs in the mount command, as shown in the following figure.
    
    spec.csi.volumeAttributes.path: The subdirectory of the file system. / is entered if it is left empty (to improve the mounting performance, / is located under the /cfs directory). If you want to specify a subdirectory for mounting, you must ensure that the subdirectory exists in /cfs in the file system. The workload cannot access the parent directory of the subdirectory after mounting. For example, for path: /test, you must ensure that the /cfs/test exists in the file system.

    Step 2. Create a PVC that is bound to the PV based on the following template

    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
    name: pvc-cfsturbo
    spec:
    storageClassName: ""
    volumeName: pv-cfsturbo
    accessModes:
    - ReadWriteMany
    resources:
    requests:
    storage: 10Gi
    Parameters:
    metadata.name: The name of the created PVC.
    spec.volumeName: It must be consistent with the name of the PV created in Step 1.

    Using a CFS Turbo volume

    Create a Pod that mounts the PVC based on the following template.
    apiVersion: v1
    kind: Pod
    metadata:
    name: nginx
    spec:
    containers:
    - image: ccr.ccs.tencentyun.com/qcloud/nginx:1.9
    imagePullPolicy: Always
    name: nginx
    ports:
    - containerPort: 80
    protocol: TCP
    volumeMounts:
    - mountPath: /var/www
    name: data
    volumes:
    - name: data
    persistentVolumeClaim:
    claimName: pvc-cfsturbo
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support