{"id":13581590,"url":"https://github.com/moosefs/moosefs-csi","last_synced_at":"2025-04-07T13:07:50.193Z","repository":{"id":69451945,"uuid":"151383304","full_name":"moosefs/moosefs-csi","owner":"moosefs","description":"Container Storage Interface (CSI) for MooseFS","archived":false,"fork":false,"pushed_at":"2024-10-31T17:20:45.000Z","size":12823,"stargazers_count":63,"open_issues_count":6,"forks_count":23,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-31T11:07:55.381Z","etag":null,"topics":["claim","cluster","csi","kubernetes","kubernetes-cluster","moosefs","persistent","persistent-storage","persistent-volume","persistent-volume-claim","storage","storage-providers-moosefs","volume"],"latest_commit_sha":null,"homepage":"https://moosefs.com","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/moosefs.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":"2018-10-03T08:34:35.000Z","updated_at":"2025-02-01T18:55:52.000Z","dependencies_parsed_at":"2024-01-14T08:31:33.245Z","dependency_job_id":"61edce4f-44b7-43d5-be46-e5242cee2749","html_url":"https://github.com/moosefs/moosefs-csi","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moosefs%2Fmoosefs-csi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moosefs%2Fmoosefs-csi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moosefs%2Fmoosefs-csi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moosefs%2Fmoosefs-csi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moosefs","download_url":"https://codeload.github.com/moosefs/moosefs-csi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247657281,"owners_count":20974345,"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":["claim","cluster","csi","kubernetes","kubernetes-cluster","moosefs","persistent","persistent-storage","persistent-volume","persistent-volume-claim","storage","storage-providers-moosefs","volume"],"created_at":"2024-08-01T15:02:06.755Z","updated_at":"2025-04-07T13:07:50.174Z","avatar_url":"https://github.com/moosefs.png","language":"Go","funding_links":[],"categories":["Roadmap","Go"],"sub_categories":["[Tutorials](#tutorials)"],"readme":"# Container Storage Interface (CSI) driver for MooseFS\n\n[Container storage interface](https://github.com/container-storage-interface/spec) is an [industry standard](https://github.com/container-storage-interface/spec/blob/master/spec.md) that enables storage vendors to develop a plugin once and have it work across a number of container orchestration systems.\n\n[MooseFS](https://moosefs.com) is a petabyte Open-Source distributed file system. It aims to be fault-tolerant, highly available, highly performing, scalable general-purpose network distributed file system for data centers.\n\nMooseFS source code can be found [on GitHub](https://github.com/moosefs/moosefs).\n\n---\n\n*Note that a pool of MooseFS Clients that are available for use by containers is created on each node. By default the number of MooseFS Clients in the pool is `1`.*\n\n## Installation on Kubernetes\n\n### Prerequisites\n\n* MooseFS Cluster up and running\n\n* `--allow-privileged=true` flag set for both API server and kubelet (default value for kubelet is `true`)\n\n### **Deployment**\n\n1.  Complete `deploy/kubernetes/csi-moosefs-config.yaml` configuration file with your settings:\n\n    * `master_host` – domain name (**recommended**) or IP address of your MooseFS Master Server(s). It is an equivalent to `-H master_host` or `-o mfsmaster=master_host` passed to MooseFS Client.\n    * `master_port` – port number of your MooseFS Master Server. It is an equivalent to `-P master_port` or `-o mfsport=master_port` passed to MooseFS Client.\n    * `k8s_root_dir` – each mount's root directory on MooseFS. Each path is relative to this one. Equivalent to `-S k8s_root_dir` or `-o mfssubfolder=k8s_root_dir` passed to MooseFS Client.\n    * `driver_working_dir` – a driver working directory inside MooseFS where persistent volumes, logs and metadata is stored (actual path is: `k8s_root_dir/driver_working_dir`)\n    * `mount_count` – number of pre created MooseFS clients running on each node\n    and apply:\n    * `mfs_logging` – driver can create logs from each component in `k8s_root_dir/driver_working_dir/logs` directory. Boolean `\"true\"`/`\"false\"` value.\n\n    ```\n    $ kubectl apply -f deploy/kubernetes/csi-moosefs-config.yaml\n    ```\n\n2.  ConfigMap should now be created:\n\n    ```\n    $ kubectl get configmap -n kube-system\n    NAME                                 DATA   AGE\n    csi-moosefs-config                   6      42s\n    ```\n\n3.  Update `deploy/kubernetes/csi-moosefs.yaml` file with the image that uses required MooseFS or MooseFS Pro version and MooseFS CSI Plugin version. Default images are the latest version of the plugin and the latest version of MooseFS (Community):\n\n    * Find plugin named `csi-moosefs-plugin`\n    * Update the `image` version suffix in the plugin's section accordingly, for example:\n        * `0.9.4-3.0.117` – for plugin version 0.9.4 and MooseFS Community 3.0.117\n        * `0.9.4-4.44.4-pro` – for plugin version 0.9.4 and MooseFS Pro 4.44.4\n\n      You can find a complete list of available images at: \\\n      https://registry.moosefs.com/v2/moosefs-csi-plugin/tags/list.\n\n      **Note there are two occurrences of `csi-moosefs-plugin` in `csi-moosefs.yaml` file and it is necessary to update the image version in both places of the file.**\n\n4.  Deploy CSI MooseFS plugin along with CSI Sidecar Containers:\n\n    ```\n    $ kubectl apply -f deploy/kubernetes/csi-moosefs.yaml\n    ```\n\n5.  Ensure that all the containers are ready, up and running\n\n    ```\n    kube@k-master:~$ kubectl get pods -n kube-system | grep csi-moosefs\n    csi-moosefs-controller-0                   4/4     Running   0          44m\n    csi-moosefs-node-7h4pj                     2/2     Running   0          44m\n    csi-moosefs-node-8n5hj                     2/2     Running   0          44m\n    csi-moosefs-node-n4prg                     2/2     Running   0          44m\n    ```\n   \n    You should see a single `csi-moosefs-controller-x` running and `csi-moosefs-node-xxxxx` one per each node.\n\n    You may also take a look at your MooseFS CGI Monitoring Interface (\"Mounts\" tab) to check if new Clients are connected – mount points: `/mnt/controller` and `/mnt/${nodeId}[_${mountId}]`.\n\n### **Verification**\n\n1.  Create a persistent volume claim for 5 GiB:\n\n    ```\n    $ kubectl apply -f examples/kubernetes/dynamic-provisioning/pvc.yaml\n    ```\n\n2.  Verify if the persistent volume claim exists and wait until it's STATUS is `Bound`:\n\n    ```\n    $ kubectl get pvc\n    NAME             STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS      AGE\n    my-moosefs-pvc   Bound    pvc-a62451d4-0d75-4f81-bfb3-8402c59bfc25   5Gi        RWX            moosefs-storage   69m\n    ```\n\n3.  After its in `Bound` state, create a sample workload that mounts the volume:\n\n    ```\n    $ kubectl apply -f examples/kubernetes/dynamic-provisioning/pod.yaml\n    ```\n\n4.  Verify the storage is mounted:\n\n    ```\n    $ kubectl exec my-moosefs-pod -- df -h /data\n    Filesystem                Size      Used Available Use% Mounted on\n    172.17.2.80:9421          4.2T      1.4T      2.8T  33% /data\n    ```\n   \n    You may take a look at MooseFS CGI Monitoring Interface (\"Quotas\" tab) to check if a quota for 5 GiB on a newly created volume directory has been set. Dynamically provisioned volumes are stored on MooseFS in `k8s_root_dir/driver_working_dir/volumes` directory.\n   \n5.  Clean up:\n\n    ```\n    $ kubectl delete -f examples/kubernetes/dynamic-provisioning/pod.yaml\n    $ kubectl delete -f examples/kubernetes/dynamic-provisioning/pvc.yaml\n    ```\n\n## More examples and capabilities\n\n### Volume Expansion\n\nVolume expansion can be done by updating and applying corresponding PVC specification.\n\n**Note:** the volume size can only be increased. Any attempts to decrease it will result in an error. It is not recommended to resize Persistent Volume MooseFS-allocated quotas via MooseFS native tools, as such changes will not be visible in your Container Orchestrator.\n\n### Static provisioning\n\nVolumes can be also provisioned statically by creating or using a existing directory in `k8s_root_dir/driver_working_dir/volumes`. Example PersistentVolume `examples/kubernetes/static-provisioning/pv.yaml` definition, requires existing volume in volumes directory.\n\n### Mount MooseFS inside containers\n\nIt is possible to mount any MooseFS directory inside containers using static provisioning.\n\n1.  Create a Persistent Volume (`examples/kubernetes/mount-volume/pv.yaml`):\n\n    ```\n    kind: PersistentVolume\n    apiVersion: v1\n    metadata:\n      name: my-moosefs-pv-mount\n    spec:\n      storageClassName: \"\"               # empty Storage Class\n      capacity:\n        storage: 1Gi                     # required, however does not have any effect\n      accessModes:\n        - ReadWriteMany\n      csi:\n        driver: csi.moosefs.com\n        volumeHandle: my-mount-volume   # unique volume name\n        volumeAttributes:\n          mfsSubDir: \"/\"                 # subdirectory to be mounted as a rootdir (inside k8s_root_dir)\n    ```\n   \n2.  Create corresponding Persistent Volume Claim (`examples/kubernetes/mount-volume/pvc.yaml`):\n\n    ```\n    kind: PersistentVolumeClaim\n    apiVersion: v1\n    metadata:\n      name: my-moosefs-pvc-mount\n    spec:\n      storageClassName: \"\"               # empty Storage Class\n      volumeName: my-moosefs-pv-mount\n      accessModes:\n        - ReadWriteMany\n      resources:\n        requests:\n          storage: 1Gi                   # at least as much as in PV, does not have any effect\n    ```   \n   \n3.  Apply both configurations:\n\n    ```\n    $ kubectl apply -f examples/kubernetes/mount-volume/pv.yaml\n    $ kubectl apply -f examples/kubernetes/mount-volume/pvc.yaml\n    ```\n   \n4.  Verify that PVC exists and wait until it is bound to the previously created PV:\n\n    ```\n    $ kubectl get pvc\n    NAME                    STATUS   VOLUME                 CAPACITY   ACCESS MODES   STORAGECLASS   AGE\n    my-moosefs-pvc-mount    Bound     my-moosefs-pv-mount   1Gi        RWX                           23m\n    ```\n   \n5.  Create a sample workload that mounts the volume:\n\n    ```\n    $ kubectl apply -f examples/kubernetes/mount-volume/pod.yaml\n    ```\n   \n6.  Verify that the storage is mounted:\n\n    ```\n    $ kubectl exec -it my-moosefs-pod-mount -- ls /data\n    ```\n   \n   You should see the content of `k8s_root_dir/mfsSubDir`.\n   \n7.  Clean up:\n\n    ```\n    $ kubectl delete -f examples/kubernetes/mount-volume/pod.yaml\n    $ kubectl delete -f examples/kubernetes/mount-volume/pvc.yaml\n    $ kubectl delete -f examples/kubernetes/mount-volume/pv.yaml\n    ```\n\nBy using `containers[*].volumeMounts[*].subPath` field of `PodSpec` it is possible to specify a proper MooseFS subdirectory using only one PV/PVC pair, without creating a new one for each subdirectory:\n\n```\nkind: Deployment\napiVersion: apps/v1\nmetadata:\n  name: my-site-app\nspec:\n  template:\n    spec:\n      containers:\n        - name: my-frontend\n          # ...\n          volumeMounts:\n            - name: my-moosefs-mount\n              mountPath: \"/var/www/my-site/assets/images\"\n              subPath: \"resources/my-site/images\"\n            - name: my-moosefs-mount\n              mountPath: \"/var/www/my-site/assets/css\"\n              subPath: \"resources/my-site/css\"\n      volumes:\n        - name: my-moosefs-mount\n          persistentVolumeClaim:\n            claimName: my-moosefs-pvc-mount\n```\n\n## Version Compatibility\n\n| Kubernetes | MooseFS CSI Driver |\n|:----------:|:------------------:|\n| `v1.26.2`  |      `v0.9.4`      |\n| `v1.24.2`  |      `v0.9.4`      |\n\n## Copyright\n\nCopyright (c) 2020-2023 Saglabs SA\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0).\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\nSee the License for the specific language governing permissions and limitations under the License.\n\n## License\n\n[Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)\n\n## Code of conduct\n\nParticipation in this project is governed by [Kubernetes/CNCF code of conduct](https://github.com/kubernetes/community/blob/master/code-of-conduct.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoosefs%2Fmoosefs-csi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoosefs%2Fmoosefs-csi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoosefs%2Fmoosefs-csi/lists"}