Add csi plugin ansible and tutorial document
[stor4nfv.git] / tutorials / csi-plugin.md
diff --git a/tutorials/csi-plugin.md b/tutorials/csi-plugin.md
new file mode 100644 (file)
index 0000000..e3b0174
--- /dev/null
@@ -0,0 +1,108 @@
+## Prerequisite ##\r
+\r
+### ubuntu\r
+* Version information\r
+\r
+       ```\r
+       root@proxy:~# cat /etc/issue\r
+       Ubuntu 16.04.2 LTS \n \l\r
+       ```\r
+\r
+### docker\r
+* Version information\r
+\r
+       ```\r
+       root@proxy:~# docker version\r
+       Client:\r
+        Version:      1.12.6\r
+        API version:  1.24\r
+        Go version:   go1.6.2\r
+        Git commit:   78d1802\r
+        Built:        Tue Jan 31 23:35:14 2017\r
+        OS/Arch:      linux/amd64\r
+       \r
+       Server:\r
+        Version:      1.12.6\r
+        API version:  1.24\r
+        Go version:   go1.6.2\r
+        Git commit:   78d1802\r
+        Built:        Tue Jan 31 23:35:14 2017\r
+        OS/Arch:      linux/amd64\r
+       ```\r
+\r
+### [kubernetes](https://github.com/kubernetes/kubernetes) local cluster\r
+* You can startup the lastest k8s local cluster by executing commands blow:\r
+\r
+       ```\r
+       cd $HOME\r
+       git clone https://github.com/kubernetes/kubernetes.git\r
+       cd $HOME/kubernetes\r
+       make\r
+       echo alias kubectl='$HOME/kubernetes/cluster/kubectl.sh' >> /etc/profile\r
+       ALLOW_PRIVILEGED=true FEATURE_GATES=CSIPersistentVolume=true,MountPropagation=true RUNTIME_CONFIG="storage.k8s.io/v1alpha1=true" LOG_LEVEL=5 hack/local-up-cluster.sh\r
+       ```\r
+\r
+### [opensds](https://github.com/opensds/opensds) local cluster\r
+* For testing purposes you can deploy OpenSDS referring the [OpenSDS Cluster Installation through Ansible](https://github.com/opensds/opensds/wiki/OpenSDS-Cluster-Installation-through-Ansible) wiki. Besides, you need to deploy opensds csi plugin refering to ```nbp-ansible/README.md```.\r
+\r
+## Testing steps ##\r
+\r
+* Change the workplace\r
+\r
+       ```\r
+       cd /opt/opensds-k8s-v0.1.0-linux-amd64\r
+       ```\r
+\r
+* Configure opensds endpoint IP\r
+\r
+       ```\r
+       vim csi/deploy/kubernetes/csi-configmap-opensdsplugin.yaml\r
+       ```\r
+\r
+       The IP (127.0.0.1) should be replaced with the opensds actual endpoint IP.\r
+       ```yaml\r
+       kind: ConfigMap\r
+       apiVersion: v1\r
+           metadata:\r
+       name: csi-configmap-opensdsplugin\r
+           data:\r
+           opensdsendpoint: http://127.0.0.1:50040\r
+       ```\r
+\r
+* Create opensds CSI pods.\r
+\r
+       ```\r
+       kubectl create -f csi/deploy/kubernetes\r
+       ```\r
+\r
+       After this three pods can be found by ```kubectl get pods``` like below:\r
+\r
+       - csi-provisioner-opensdsplugin\r
+       - csi-attacher-opensdsplugin\r
+       - csi-nodeplugin-opensdsplugin\r
+\r
+       You can find more design details from\r
+    [CSI Volume Plugins in Kubernetes Design Doc](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/storage/container-storage-interface.md)\r
+\r
+* Create example nginx application\r
+\r
+       ```\r
+       kubectl create -f csi/examples/kubernetes/nginx.yaml\r
+       ```\r
+\r
+       This example will mount a opensds volume into ```/var/lib/www/html```.\r
+\r
+       You can use the following command to inspect into nginx container to verify it.\r
+\r
+       ```\r
+       docker exec -it <nginx container id> /bin/bash\r
+       ```\r
+\r
+## Clean up steps ##\r
+\r
+Clean up example nginx application and opensds CSI pods by the following commands.\r
+\r
+```\r
+kubectl delete -f csi/examples/kubernetes/nginx.yaml\r
+kubectl delete -f csi/deploy/kubernetes\r
+```\r