tencent cloud

Feedback

Using CFS Turbo on TKE

Last updated: 2024-01-22 22:15:48

    Overview

    This document describes how to integrate CFS Turbo with a Tencent Kubernetes Engine (TKE) cluster.

    Prerequisites

    The operating system of the TKE host node is compatible with the Turbo series.
    You have installed a Turbo-based client on all TKE nodes. You are advised to use pshell to operate in batches.
    For the compatible operating systems and how to install the client, see Using CFS Turbo on Linux Clients.

    Directions

    Using kubectl to connect to a cluster

    Use kubectl to connect to a TKE cluster. For more information, see Connecting to a Cluster.

    Creating a Pod for mounting Turbo using YAML files

    2. Go to the kubernetes-csi-tencentcloud/deploy/cfsturbo/kubernetes/ directory and upload csi-node-rbac.yaml, csi-node.yaml, and csidriver-new.yaml files to the kubectl management node.
    3. Go to the kubernetes-csi-tencentcloud/deploy/cfsturbo/examples/ directory and download the pv.yaml, pvc.yaml, and pod.yaml sample files.
    4. Modify the pv.yaml, pvc.yaml, and pod.yaml files based on the PV, PVC, and Pod attributes, such as name and image address. Below are the sample YAML files:
    apiVersion: v1
    kind: PersistentVolume
    metadata:
    name: csi-cfsturbo-pv
    spec:
    accessModes:
    - ReadWriteMany
    capacity:
    storage: 10Gi
    csi:
    driver: com.tencent.cloud.csi.cfsturbo
    # volumeHandle in PV must be unique, use pv name is better
    volumeHandle: csi-cfsturbo-pv
    volumeAttributes:
    # cfs turbo proto
    proto: lustre
    # cfs turbo rootdir
    rootdir: /cfs
    # cfs turbo fsid (not cfs id)
    fsid: d3dcc487
    # cfs turbo server ip
    host: 10.0.1.16
    # cfs turbo subPath
    path: /
    storageClassName: ""
    ---
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
    name: csi-cfsturbo-pvc
    spec:
    accessModes:
    - ReadWriteMany
    resources:
    requests:
    storage: 10Gi
    # You can specify the pv name manually or just let Kubernetes bind the pv and pvc.
    volumeName: csi-cfsturbo-pv
    # cfsturbo only supports static provisioning, the StorageClass name should be empty.
    storageClassName: ""
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
    labels:
    k8s-app: csi-cfsturbo-pod
    name: csi-cfsturbo-pod
    spec:
    replicas: 1
    selector:
    matchLabels:
    k8s-app: csi-cfsturbo-pod
    template:
    metadata:
    labels:
    k8s-app: csi-cfsturbo-pod
    spec:
    containers:
    - image: nginx
    name: csi-cfsturbo-pod
    volumeMounts:
    - mountPath: /csi-cfsturbo
    name: csi-cfsturbo
    volumes:
    - name: csi-cfsturbo
    persistentVolumeClaim:
    # Replaced by your pvc name.
    claimName: csi-cfsturbo-pvc
    
    Below is the sample command for mounting:
    sudo mount.lustre -o sync,user_xattr 10.0.1.16@tcp0:/d3dcc487/cfs /path/to/mount
    Below are key parameters:
    proto:lustre: Keep this parameter unchanged.
    roodir:/cfs: Keep this parameter unchanged.
    fsid:d3dcc487: Here, fsid is not the CFSID, and you need to enter the information in the mount directory.
    host:10.0.1.16: IP of the mount point.
    path: You can adjust it based on the target subdirectory. To directly mount the root directory, enter "/".
    5. Run the following commands in sequence in the directory where the script is uploaded:
    Configure RBAC and CSI plugins.
    kubectl apply -f csi-node-rbac.yaml && kubectl apply -f csidriver-new.yaml && kubectl apply -f csi-node.yaml
    Create PV, PVC, and Pod:
    kubectl create -f pv.yaml && kubectl create -f pvc.yaml && kubectl create -f pod.yaml
    6. Run the following command to view the Pod status:
    kubectl get pod -n default -o wide
    If the message below is displayed, the Pod is created successfully.
    
    
    If the value of STATUS is ContainerCreating, the creation failed. You can view the failure reason based on the events in the TKE console.
    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