Merge nbp installation into opensds ansible script
[stor4nfv.git] / tutorials / flexvolume-plugin.md
1 ## Prerequisite ##\r
2 \r
3 ### ubuntu\r
4 * Version information\r
5 \r
6         ```\r
7         root@proxy:~# cat /etc/issue\r
8         Ubuntu 16.04.2 LTS \n \l\r
9         ```\r
10 \r
11 ### docker\r
12 * Version information\r
13 \r
14         ```\r
15         root@proxy:~# docker version\r
16         Client:\r
17          Version:      1.12.6\r
18          API version:  1.24\r
19          Go version:   go1.6.2\r
20          Git commit:   78d1802\r
21          Built:        Tue Jan 31 23:35:14 2017\r
22          OS/Arch:      linux/amd64\r
23 \r
24         Server:\r
25          Version:      1.12.6\r
26          API version:  1.24\r
27          Go version:   go1.6.2\r
28          Git commit:   78d1802\r
29          Built:        Tue Jan 31 23:35:14 2017\r
30          OS/Arch:      linux/amd64\r
31         ```\r
32 \r
33 ### [kubernetes](https://github.com/kubernetes/kubernetes) local cluster\r
34 * Version information\r
35         ```\r
36         root@proxy:~# kubectl version\r
37         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
38         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
39         ```\r
40 * You can startup the k8s local cluster by executing commands blow:\r
41 \r
42         ```\r
43         cd $HOME\r
44         git clone https://github.com/kubernetes/kubernetes.git\r
45         cd $HOME/kubernetes\r
46         git checkout v1.9.0\r
47         make\r
48         echo alias kubectl='$HOME/kubernetes/cluster/kubectl.sh' >> /etc/profile\r
49         RUNTIME_CONFIG=settings.k8s.io/v1alpha1=true AUTHORIZATION_MODE=Node,RBAC hack/local-up-cluster.sh -O\r
50         ```\r
51 \r
52 \r
53 ### [opensds](https://github.com/opensds/opensds) local cluster\r
54 * For testing purposes you can deploy OpenSDS local cluster referring to ```ansible/README.md```.\r
55 \r
56 ## Testing steps ##\r
57 \r
58 * Create service account, role and bind them.\r
59         ```\r
60         cd /opt/opensds-k8s-{release version}-linux-amd64/provisioner\r
61         kubectl create -f serviceaccount.yaml\r
62         kubectl create -f clusterrole.yaml\r
63         kubectl create -f clusterrolebinding.yaml\r
64         ```\r
65 \r
66 * Change the opensds endpoint IP in pod-provisioner.yaml\r
67 The IP ```192.168.56.106``` should be replaced with the OpenSDS osdslet actual endpoint IP.\r
68     ```yaml\r
69     kind: Pod\r
70     apiVersion: v1\r
71     metadata:\r
72       name: opensds-provisioner\r
73     spec:\r
74       serviceAccount: opensds-provisioner\r
75       containers:\r
76         - name: opensds-provisioner\r
77           image: opensdsio/opensds-provisioner:latest\r
78           securityContext:\r
79           args:\r
80             - "-endpoint=http://192.168.56.106:50040" # should be replaced\r
81           imagePullPolicy: "IfNotPresent"\r
82     ```\r
83 \r
84 * Create provisioner pod.\r
85         ```\r
86         kubectl create -f pod-provisioner.yaml\r
87         ```\r
88 \r
89 * You can use the following cammands to test the OpenSDS FlexVolume and Proversioner functions.\r
90 \r
91         ```\r
92         kubectl create -f sc.yaml              # Create StorageClass\r
93         kubectl create -f pvc.yaml             # Create PVC\r
94         kubectl create -f pod-application.yaml # Create busybox pod and mount the block storage.\r
95         ```\r
96 \r
97         Execute the `findmnt|grep opensds` to confirm whether the volume has been provided.\r
98 \r
99 ## Clean up steps ##\r
100 \r
101 ```\r
102 kubectl delete -f pod-application.yaml\r
103 kubectl delete -f pvc.yaml\r
104 kubectl delete -f sc.yaml\r
105 \r
106 kubectl delete -f pod-provisioner.yaml\r
107 kubectl delete -f clusterrolebinding.yaml\r
108 kubectl delete -f clusterrole.yaml\r
109 kubectl delete -f serviceaccount.yaml\r
110 ```