tencent cloud


Using CFS on TKE

Last updated: 2022-01-18 14:38:06


    Tencent Kubernetes Engine (TKE) is a container management service with high scalability and performance. It provides a variety of application release methods and continuous delivery capabilities and supports microservice architectures. It can solve environment-related issues in the process of development, testing, and OPS and help you reduce costs and improve efficiency.

    Businesses using containers usually involve shared access by multiple containers to a high number of configuration files, model files, log data, and attachments in such scenarios as business application deployment, DevOps, machine learning, and auto-scaling. Especially, in scenarios like machine learning, intelligent recommendation, and log data processing, in addition to basic data sharing, shared storage is also required to provide services that feature high throughput, high IOPS, and low latency and can sustain high concurrent requests. CFS can provide such services after simple configuration and mount to containers, making it particularly suitable for use in conjunction with TKE. This document describes how to use CFS on TKE.


    You have already created a TKE cluster. If you haven't done so, please create one first as instructed in Deploying TKE.

    Applying for CFS Resources and Getting Mount Point IP

    • If you do not have a file system, please create one as instructed in Creating File Systems and Mount Points. Please make sure that the VPC you select when creating the file system is the same as that of your TKE master to ensure network interconnectivity.
    • If you already have a file system in the same VPC as your TKE instance, you can enter the "File System Details" page to get the mount point IP.

    Configuring CFS File System Mounting

    Step 1. Start the NFS client on the node

    Before mounting, please make sure that nfs-utils or nfs-common has already been installed in the system. The installation method is as follows:

    • CentOS

      sudo yum install nfs-utils
    • Ubuntu

      sudo apt-get install nfs-common

    Step 2. Create a PV

    Run the following command to create a PesistentVolume (PV) of CFS type.

    apiVersion: v1
    kind: PersistentVolume
     name: cfs
       storage: 10Gi
     volumeMode: Filesystem
       - ReadWriteMany
     persistentVolumeReclaimPolicy: Retain
       - hard
       - nfsvers=4
       path: /

    • nfs.server: mount point IP of the CFS file system obtained above. The file system IP is in this example.
    • nfs.path: root directory or subdirectory of the CFS file system. The root directory is used in this example.

    Step 3. Create a PVC

    Then, create a PersistentVolumeClaim (PVC) and bind it to the PV.

    kind: PersistentVolumeClaim
    apiVersion: v1
     name: cfsclaim
       - ReadWriteMany
     volumeMode: Filesystem
     storageClassName: ""
         storage: 10Gi

    Step 4. Create a pod

    Create a pod to declare that this volume is used for mounting.

    kind: Pod
    apiVersion: v1
    name: mypod
      - name: myfrontend
        image: nginx
        - mountPath: "/var/www/html"
          name: mypd
      - name: mypd
          claimName: cfsclaim

    After the above steps are completed, you can use the file system in the newly created pod.

    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