Add nbp-ansible script to deploy opensds northbound plugins
[stor4nfv.git] / tutorials / flexvolume-plugin.md
diff --git a/tutorials/flexvolume-plugin.md b/tutorials/flexvolume-plugin.md
new file mode 100644 (file)
index 0000000..450acd5
--- /dev/null
@@ -0,0 +1,108 @@
+## Prerequisite ##\r
+### ubuntu\r
+* Version information\r
+\r
+       ```\r
+       root@proxy:~# cat /etc/issue\r
+       Ubuntu 16.04.2 LTS \n \l\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
+* Version information\r
+       ```\r
+       root@proxy:~# kubectl version\r
+       Client Version: version.Info{Major:"1", Minor:"9+", GitVersion:"v1.9.0-beta.0-dirty", GitCommit:"a0fb3baa71f1559fd42d1acd9cbdd8a55ab4dfff", GitTreeState:"dirty", BuildDate:"2017-12-13T09:22:09Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"linux/amd64"}\r
+       Server Version: version.Info{Major:"1", Minor:"9+", GitVersion:"v1.9.0-beta.0-dirty", GitCommit:"a0fb3baa71f1559fd42d1acd9cbdd8a55ab4dfff", GitTreeState:"dirty", BuildDate:"2017-12-13T09:22:09Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"linux/amd64"}\r
+       ```\r
+* You can startup the 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
+       git checkout v1.9.0\r
+       make\r
+       echo alias kubectl='$HOME/kubernetes/cluster/kubectl.sh' >> /etc/profile\r
+       RUNTIME_CONFIG=settings.k8s.io/v1alpha1=true AUTHORIZATION_MODE=Node,RBAC hack/local-up-cluster.sh -O\r
+       ```\r
+\r
+\r
+### [opensds](https://github.com/opensds/opensds) local cluster\r
+* For testing purposes you can deploy OpenSDS local cluster referring to ```ansible/README.md```. Besides, you need to deploy opensds flexvolume plugin refering to ```nbp-ansible/README.md```.\r
+\r
+## Testing steps ##\r
+\r
+* Create service account, role and bind them.\r
+       ```\r
+       cd /opt/opensds-k8s-linux-amd64/provisioner\r
+       kubectl create -f serviceaccount.yaml\r
+       kubectl create -f clusterrole.yaml\r
+       kubectl create -f clusterrolebinding.yaml\r
+       ```\r
+\r
+* Change the opensds endpoint IP in pod-provisioner.yaml\r
+The IP (192.168.56.106) should be replaced with the OpenSDS osdslet actual endpoint IP.\r
+    ```yaml\r
+    kind: Pod\r
+    apiVersion: v1\r
+    metadata:\r
+      name: opensds-provisioner\r
+    spec:\r
+      serviceAccount: opensds-provisioner\r
+      containers:\r
+        - name: opensds-provisioner\r
+          image: opensdsio/opensds-provisioner\r
+          securityContext:\r
+          args:\r
+            - "-endpoint=http://192.168.56.106:50040" # should be replaced\r
+          imagePullPolicy: "IfNotPresent"\r
+    ```\r
+\r
+* Create provisioner pod.\r
+       ```\r
+       kubectl create -f pod-provisioner.yaml\r
+       ```\r
+\r
+* You can use the following cammands to test the OpenSDS FlexVolume and Proversioner functions.\r
+\r
+       ```\r
+       kubectl create -f sc.yaml              # Create StorageClass\r
+       kubectl create -f pvc.yaml             # Create PVC\r
+       kubectl create -f pod-application.yaml # Create busybox pod and mount the block storage.\r
+       ```\r
+\r
+       Execute the `findmnt|grep opensds` to confirm whether the volume has been provided.\r
+\r
+## Clean up steps ##\r
+\r
+```\r
+kubectl delete -f pod-application.yaml\r
+kubectl delete -f pvc.yaml\r
+kubectl delete -f sc.yaml\r
+\r
+kubectl delete -f pod-provisioner.yaml\r
+kubectl delete -f clusterrolebinding.yaml\r
+kubectl delete -f clusterrole.yaml\r
+kubectl delete -f serviceaccount.yaml\r
+```
\ No newline at end of file