Giter Club home page Giter Club logo

chubaofs-csi's Introduction

ChubaoFS CSI

Prerequisite

  • Kubernetes 1.16.0
  • ChubaoFS 1.4.0

Enable privileged Pods

To use CSI drivers, your Kubernetes cluster must allow privileged pods (i.e. --allow-privileged flag must be set to true for both the API server and the kubelet). Ensure your API server are started with the privileged flag.

$ ./kube-apiserver ...  --allow-privileged=true ...
$ ./kubelet ...  --allow-privileged=true ...

Note: Starting from Kubernetes 1.13.0, --allow-privileged is true for kubelet. It'll be deprecated in future kubernetes releases. Please refer to Kubernetes CSI Deploy for more details.

Prepare on-premise ChubaoFS cluster

An on-premise ChubaoFS cluster can be deployed seperately, or within the same Kubernetes cluster as applications which requrie persistent volumes. Please refer to chubaofs-helm for more details on deployment using Helm.

Deploy the CSI driver

$ kubectl apply -f deploy/csi-controller-deployment.yaml
$ kubectl apply -f deploy/csi-node-daemonset.yaml

Connect Pod to ChubaoFS cluster

There are several abstraction layers between Pods and on-premise ChubaoFS cluster, and we are going to establish the connection through following steps for a Pod to use ChubaoFS as its backend storage.

  1. Create StorageClass
  2. Create PVC (Persistent Volume Claim)
  3. Refer to a PVC in Pod

Create StorageClass

An example storage class yaml file looks like below.

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: chubaofs-sc
provisioner: csi.chubaofs.com
reclaimPolicy: Delete
parameters:
  masterAddr: "master-service.chubaofs.svc.cluster.local:8080"
  owner: "csi-user"
  consulAddr: "consul-service.chubaofs.svc.cluster.local:8500"
  logLevel: "debug"

Use the following command to create.

$ kubectl create -f ~/storageclass-chubaofs.yaml

The field provisioner indicates name of the CSI driver, which is csi.chubaofs.com in this example. It is connected to the drivername in deploy/csi-controller-deployment.yaml and deploy/csi-node-daemonset.yaml. So StorageClass knows which driver should be used to manipulate the backend storage cluster.

Name Madotory Description
MasterAddr Y Master address of a specific on-premise ChubaoFS cluster
consulAddr N

Create PVC

An example pvc yaml file looks like below.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: chubaofs-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
  storageClassName: chubaofs-sc
$ kubectl create -f ~/pvc.yaml

The field storageClassName refers to the StorageClass we already created.

Use PVC in a Pod

The example nginx-deployment.yaml looks like below.

...
    spec:
      containers:
        - name: csi-demo
          image: alpine:3.10.3
          volumeMounts:
            - name: mypvc
              mountPath: /data
      volumes:
        - name: mypvc
          persistentVolumeClaim:
            claimName: chubaofs-pvc
...

The field claimName refers to the PVC we already created.

$ kubectl create -f ~/nginx-deployment.yaml

chubaofs-csi's People

Contributors

shuoranliu avatar awzhgw avatar xuxihao1 avatar 1032120121 avatar chengyu-l avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.