3 * Version information
\r
6 root@proxy:~# cat /etc/issue
\r
7 Ubuntu 16.04.2 LTS \n \l
\r
10 * Version information
\r
13 root@proxy:~# docker version
\r
19 Built: Tue Jan 31 23:35:14 2017
\r
20 OS/Arch: linux/amd64
\r
27 Built: Tue Jan 31 23:35:14 2017
\r
28 OS/Arch: linux/amd64
\r
31 ### [golang](https://redirector.gvt1.com/edgedl/go/go1.9.2.linux-amd64.tar.gz)
\r
32 * Version information
\r
35 root@proxy:~# go version
\r
36 go version go1.9.2 linux/amd64
\r
39 * You can install golang by executing commands blow:
\r
42 wget https://storage.googleapis.com/golang/go1.9.2.linux-amd64.tar.gz
\r
43 tar -C /usr/local -xzf go1.9.2.linux-amd64.tar.gz
\r
44 export PATH=$PATH:/usr/local/go/bin
\r
45 export GOPATH=$HOME/gopath
\r
48 ### [kubernetes](https://github.com/kubernetes/kubernetes) local cluster
\r
49 * Version information
\r
51 root@proxy:~# kubectl version
\r
52 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
53 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
55 * You can startup the k8s local cluster by executing commands blow:
\r
59 git clone https://github.com/kubernetes/kubernetes.git
\r
63 echo alias kubectl='$HOME/kubernetes/cluster/kubectl.sh' >> /etc/profile
\r
64 RUNTIME_CONFIG=settings.k8s.io/v1alpha1=true AUTHORIZATION_MODE=Node,RBAC hack/local-up-cluster.sh -O
\r
67 <div> Due to opensds using etcd as the database which is same with kubernetes so you should startup kubernetes firstly.
\r
70 ### [opensds](https://github.com/opensds/opensds) local cluster
\r
71 * For testing purposes you can deploy OpenSDS referring the [Local Cluster Installation with LVM](https://github.com/opensds/opensds/wiki/Local-Cluster-Installation-with-LVM) wiki.
\r
74 * Load some ENVs which is setted before.
\r
79 * Download nbp source code.
\r
83 git clone https://github.com/opensds/nbp.git $GOPATH/src/github.com/opensds/nbp
\r
88 go get -v github.com/opensds/nbp/...
\r
91 * Build the FlexVolume.
\r
94 cd $GOPATH/src/github.com/opensds/nbp/flexvolume
\r
95 go build -o opensds ./cmd/flex-plugin/
\r
98 FlexVolume plugin binary is on the current directory.
\r
101 * Copy the OpenSDS FlexVolume binary file to k8s kubelet `volume-plugin-dir`.
\r
102 if you don't specify the `volume-plugin-dir`, you can execute commands blow:
\r
105 mkdir -p /usr/libexec/kubernetes/kubelet-plugins/volume/exec/opensds.io~opensds/
\r
106 cp $GOPATH/src/github.com/opensds/nbp/flexvolume/opensds /usr/libexec/kubernetes/kubelet-plugins/volume/exec/opensds.io~opensds/
\r
111 OpenSDS FlexVolume will get the opensds api endpoint from the environment variable `OPENSDS_ENDPOINT`, if you don't specify it, the FlexVolume will use the default vaule: `http://127.0.0.1:50040`. if you want to specify the `OPENSDS_ENDPOINT` executing command `export OPENSDS_ENDPOINT=http://ip:50040` and restart the k8s local cluster.
\r
114 * Build the provisioner docker image.
\r
117 cd $GOPATH/src/github.com/opensds/nbp/opensds-provisioner
\r
121 * Create service account, role and bind them.
\r
123 cd $GOPATH/src/github.com/opensds/nbp/opensds-provisioner/examples
\r
124 kubectl create -f serviceaccount.yaml
\r
125 kubectl create -f clusterrole.yaml
\r
126 kubectl create -f clusterrolebinding.yaml
\r
129 * Change the opensds endpoint IP in pod-provisioner.yaml
\r
130 The IP (192.168.56.106) should be replaced with the OpenSDS osdslet actual endpoint IP.
\r
135 name: opensds-provisioner
\r
137 serviceAccount: opensds-provisioner
\r
139 - name: opensds-provisioner
\r
140 image: opensdsio/opensds-provisioner
\r
143 - "-endpoint=http://192.168.56.106:50040" # should be replaced
\r
144 imagePullPolicy: "IfNotPresent"
\r
147 * Create provisioner pod.
\r
149 kubectl create -f pod-provisioner.yaml
\r
152 Execute `kubectl get pod` to check if the opensds-provisioner is ok.
\r
154 root@nbp:~/go/src/github.com/opensds/nbp/opensds-provisioner/examples# kubectl get pod
\r
155 NAME READY STATUS RESTARTS AGE
\r
156 opensds-provisioner 1/1 Running 0 42m
\r
158 * You can use the following cammands to test the OpenSDS FlexVolume and Proversioner functions.
\r
160 Create storage class.
\r
162 kubectl create -f sc.yaml # Create StorageClass
\r
164 Execute `kubectl get sc` to check if the storage class is ok.
\r
166 root@nbp:~/go/src/github.com/opensds/nbp/opensds-provisioner/examples# kubectl get sc
\r
167 NAME PROVISIONER AGE
\r
168 opensds opensds/nbp-provisioner 46m
\r
169 standard (default) kubernetes.io/host-path 49m
\r
173 kubectl create -f pvc.yaml # Create PVC
\r
175 Execute `kubectl get pvc` to check if the pvc is ok.
\r
177 root@nbp:~/go/src/github.com/opensds/nbp/opensds-provisioner/examples# kubectl get pvc
\r
178 NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
\r
179 opensds-pvc Bound 731da41e-c9ee-4180-8fb3-d1f6c7f65378 1Gi RWO opensds 48m
\r
182 Create busybox pod.
\r
185 kubectl create -f pod-application.yaml # Create busybox pod and mount the block storage.
\r
187 Execute `kubectl get pod` to check if the busybox pod is ok.
\r
189 root@nbp:~/go/src/github.com/opensds/nbp/opensds-provisioner/examples# kubectl get pod
\r
190 NAME READY STATUS RESTARTS AGE
\r
191 busy-pod 1/1 Running 0 49m
\r
192 opensds-provisioner 1/1 Running 0 50m
\r
194 Execute the `findmnt|grep opensds` to confirm whether the volume has been provided.
\r
195 If there is some thing that goes wrong, you can check the log files in directory `/var/log/opensds`.
\r
197 ## Clean up steps ##
\r
200 kubectl delete -f pod-application.yaml
\r
201 kubectl delete -f pvc.yaml
\r
202 kubectl delete -f sc.yaml
\r
204 kubectl delete -f pod-provisioner.yaml
\r
205 kubectl delete -f clusterrolebinding.yaml
\r
206 kubectl delete -f clusterrole.yaml
\r
207 kubectl delete -f serviceaccount.yaml
\r