Container Storage Interface (CSI) driver, provisioner, and attacher for MacroSAN.
MacroSAN CSI plugins implement an interface between CSI enabled Container Orchestrator (CO) and the storage of MacroSAN. It allows dynamically provisioning MacroSAN volumes and attaching them to workloads. Current implementation of MacroSAN CSI plugins was tested in Kubernetes environment (requires Kubernetes 1.13+), but the code does not rely on any Kubernetes specific calls (WIP to make it k8s agnostic) and should be able to run with any CSI enabled CO.
For details about configuration and deployment of MacroSAN CSI plugins, please refer the documentation.
For example usage of this MacroSAN CSI plugins, see examples below.
Before to go, you should have MacroSAN block-storage Product.
You can get latest version of MacroSAN CSI driver at docker hub by running docker docker pull macrosan/csi-macrosan:v1.0.0
In this section,you will learn how to deploy the CSI driver and some necessary sidecar containers.
Cluster | version |
---|---|
Kubernetes | 1.13 + |
MacroSAN ODSP | 1.3.5 + |
Get yaml file from below links:
Get bash shell from below links:
-
Deploy CSI sidecar containers and CSI driver:
$ sh create-csi-macrosan.sh
-
Verify pod:
$ kubectl get pods -n kube-system --selector=app=csi-macrosan
Congratulation to you, you have just finished the deployment. Now you can use them to provisioning MacroSAN service.
In this section,you will learn how to dynamic provision volumes with MacroSAN CSI driver. Here will Assumes that MacroSAN Storage Device is running normally.
To continue, make sure you have finish the Deployment part.
Login to you MacroSAN ODSP dashboard, your dashboard address should be https://your_domain_ip
.
Sample(ms-sc.yaml) & Explanation
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: sc-macrosan
provisioner: csi-macrosan
parameters:
SP_eth0: 172.22.251.160,172.22.251.161
targetType: iSCSI
target: iSCSI-Target-1:2:1,iSCSI-Target-2:2:1
fsType: ext4
reclaimPolicy: Delete
-
SP_eth0
: Management IP of MacroSAN Storage Device. -
targetType
: Target type, currently only iSCSI type is supported. -
target
: Target name, Target can select one or more, each Target corresponds to an access path. -
fsType
:ext3
,ext4
. Defaultext4
.
$ kubectl create -f ms-sc.yaml
Sample(pvc.yaml)
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: macrosan-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 5Gi
storageClassName: sc-macrosan
$ kubectl create -f pvc.yaml
Sample(mongo-deployment.yaml)
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: mongo-deployment
spec:
replicas: 1
selector:
matchLabels:
app: mongo
template:
metadata:
labels:
app: mongo
spec:
containers:
- name: mongo
image: mongo:latest
imagePullPolicy: "IfNotPresent"
volumeMounts:
- mountPath: /data/db
name: mypvc
volumes:
- name: mypvc
persistentVolumeClaim:
claimName: macrosan-pvc
readOnly: false
$ kubectl create -f mongo-deployment.yaml
$ kubectl get pods