{"id":18851978,"url":"https://github.com/cubefs/cubefs-csi","last_synced_at":"2025-04-14T09:53:08.512Z","repository":{"id":43844650,"uuid":"187789543","full_name":"cubefs/cubefs-csi","owner":"cubefs","description":"CubeFS Container Storage Interface (CSI) plugins.","archived":false,"fork":false,"pushed_at":"2024-05-06T02:06:58.000Z","size":45143,"stargazers_count":47,"open_issues_count":11,"forks_count":24,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-05-28T17:12:48.890Z","etag":null,"topics":["cloud-native","csi-driver","kubernetes"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cubefs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-21T07:58:38.000Z","updated_at":"2024-05-09T03:10:51.000Z","dependencies_parsed_at":"2024-05-06T03:25:10.822Z","dependency_job_id":"2758d25f-c3dd-42d2-8317-d1b5862ee3e8","html_url":"https://github.com/cubefs/cubefs-csi","commit_stats":{"total_commits":72,"total_committers":13,"mean_commits":5.538461538461538,"dds":0.6666666666666667,"last_synced_commit":"97e6ade5fbf40feaf207f2e416815bb6755d7851"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cubefs%2Fcubefs-csi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cubefs%2Fcubefs-csi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cubefs%2Fcubefs-csi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cubefs%2Fcubefs-csi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cubefs","download_url":"https://codeload.github.com/cubefs/cubefs-csi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248860153,"owners_count":21173339,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud-native","csi-driver","kubernetes"],"created_at":"2024-11-08T03:37:26.604Z","updated_at":"2025-04-14T09:53:08.480Z","avatar_url":"https://github.com/cubefs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/cubefs/cubefs-csi.svg?branch=master)](https://travis-ci.org/cubefs/cubefs-csi)\n\n# CubeFS CSI Driver\n\n## Overview\n\nCubeFS Container Storage Interface (CSI) plugins.\n\n## Governance\n* CSI is a sub-project of the CubeFS main project, complying with the rules of CubeFS main projects.\n* CSI does not have independent leadership, adopting the same leadership strategy as the CubeFS main project.\n* Contributions to CSI are equivalent to contributions to the main project and can be used as a basis for community role promotion.\n\n## Prerequisite\n\n* Kubernetes 1.16.0\n* CSI spec version 1.1.0\n\n## Prepare on-premise CubeFS cluster\n\nAn on-premise CubeFS cluster can be deployed separately, or within the same Kubernetes cluster as applications which require persistent volumes. Please refer to [cubefs-helm](https://github.com/cubefs/cubefs-helm) for more details on deployment using Helm.\n\n\n\n# Deploy\n\nCSI supports deploy with helm as well as using raw YAML files.\n\nThough, the first step of these two methods are label the node:\n\n## Add labels to Kubernetes node\n\nYou should tag each Kubernetes node with the appropriate labels accorindly for CSI node of CubeFS.\n`deploy/csi-controller-deployment.yaml` and `deploy/csi-node-daemonset.yaml` have `nodeSelector` element,\nso you should add a label for nodes. If you want using CubeFS CSI in whole kubernetes cluster, you can delete `nodeSelector` element.\n\n```\nkubectl label node \u003cnodename\u003e component.cubefs.io/csi=enabled\n```\n\n##\n\n## Direct Raw Files Deployment\n\n### Deploy the CSI driver\n\n```\n$ kubectl apply -f deploy/csi-rbac.yaml\n$ kubectl apply -f deploy/csi-controller-deployment.yaml\n$ kubectl apply -f deploy/csi-node-daemonset.yaml\n```\n\u003e **Notes:** If your kubernetes cluster alter the kubelet path `/var/lib/kubelet` to other path(such as: `/data1/k8s/lib/kubelet`), you must execute the following commands to update the path:\n\u003e\n\u003e `sed -i 's#/var/lib/kubelet#/data1/k8s/lib/kubelet#g'  deploy/csi-controller-deployment.yaml`\n\u003e\n\u003e `sed -i 's#/var/lib/kubelet#/data1/k8s/lib/kubelet#g'  deploy/csi-node-daemonset.yaml`\n\n### Use Remote CubeFS Cluster as backend storage\n\nThere is only 3 steps before finally using remote CubeFS cluster as file system\n\n1. Create StorageClass\n2. Create PVC (Persistent Volume Claim)\n3. Reference PVC in a Pod\n\n### Create StorageClass\n\nAn example storage class yaml file is shown below.\n\n```yaml\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: cfs-sc\nprovisioner: csi.cubefs.com\nreclaimPolicy: Delete\nparameters:\n  masterAddr: \"master-service.cubefs.svc.cluster.local:17010\"\n  consulAddr: \"http://consul-service.cubefs.svc.cluster.local:8500\"\n  owner: \"csiuser\"\n  logLevel: \"debug\"\n```\n\nCreating command.\n\n```\n$ kubectl create -f deploy/storageclass.yaml\n```\n\n\n\n## Helm Deployment\n\n### Download the CubeFS-Helm project\n\n```\ngit clone https://github.com/cubefs/cubefs-helm\ncd cubefs-helm\n```\n\n### Edit the values file\n\nCreate a values file, and edit it as below:\n\n`vi ~/cubefs.yaml`\n\n```\ncomponent:\n  master: false\n  datanode: false\n  metanode: false\n  objectnode: false\n  client: false\n  csi: true\n  monitor: false\n  ingress: false\n\nimage:\n  # CSI related images\n  csi_driver: ghcr.io/cubefs/cfs-csi-driver:3.2.0.150.0\n  csi_provisioner: registry.k8s.io/sig-storage/csi-provisioner:v2.2.2\n  csi_attacher: registry.k8s.io/sig-storage/csi-attacher:v3.4.0\n  csi_resizer: registry.k8s.io/sig-storage/csi-resizer:v1.3.0\n  driver_registrar: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.5.0\n\ncsi:\n  driverName: csi.cubefs.com\n  logLevel: error\n  # If you changed the default kubelet home path, this\n  # value needs to be modified accordingly\n  kubeletPath: /var/lib/kubelet\n  controller:\n    tolerations: [ ]\n    nodeSelector:\n      \"component.cubefs.io/csi\": \"enabled\"\n  node:\n    tolerations: [ ]\n    nodeSelector:\n      \"component.cubefs.io/csi\": \"enabled\"\n    resources:\n      enabled: false\n      requests:\n        memory: \"4048Mi\"\n        cpu: \"2000m\"\n      limits:\n        memory: \"4048Mi\"\n        cpu: \"2000m\"\n  storageClass:\n    # Whether automatically set this StorageClass to default volume provisioner\n    setToDefault: true\n    # StorageClass reclaim policy, 'Delete' or 'Retain' is supported\n    reclaimPolicy: \"Delete\"\n    # Override the master address parameter to connect to external cluster, if the cluster is deployed\n    # in the same k8s cluster, it can be omitted.\n    masterAddr: \"\"\n    otherParameters:\n```\n\n### Install\n\n`helm upgrade --install cubefs ./cubefs -f ~/cubefs.yaml -n cubefs --create-namespace`\n\n## Verify\n\nAfter we installed the CSI, we can create a PVC and mount it inside a Pod to verify if everything all right.\n\n### Create PVC\n\nAn example pvc yaml file is shown below.\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: cfs-pvc\nspec:\n  accessModes:\n  - ReadWriteMany\n  volumeMode: Filesystem\n  resources:\n    requests:\n      storage: 5Gi\n  storageClassName: cfs-sc\n```\n\n```\n$ kubectl create -f example/pvc.yaml\n```\n\nThe field `storageClassName` refers to the StorageClass we already created.\n\n### Use PVC in a Pod\n\nThe example `deployment.yaml` looks like below.\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: cfs-csi-demo\n  namespace: default\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: cfs-csi-demo-pod\n  template:\n    metadata:\n      labels:\n        app: cfs-csi-demo-pod\n    spec:\n      containers:\n        - name: cubefs-csi-demo\n          image: nginx:1.17.9\n          imagePullPolicy: \"IfNotPresent\"\n          ports:\n            - containerPort: 80\n              name: \"http-server\"\n          volumeMounts:\n            - mountPath: \"/usr/share/nginx/html\"\n              name: mypvc\n      volumes:\n        - name: mypvc\n          persistentVolumeClaim:\n            claimName: cfs-pvc\n```\n\nThe field `claimName` refers to the PVC created before.\n```\n$ kubectl create -f examples/deployment.yaml\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcubefs%2Fcubefs-csi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcubefs%2Fcubefs-csi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcubefs%2Fcubefs-csi/lists"}