## Prerequisite ##\r
-\r
### ubuntu\r
* Version information\r
\r
- ```\r
+ ```bash\r
root@proxy:~# cat /etc/issue\r
Ubuntu 16.04.2 LTS \n \l\r
```\r
-\r
### docker\r
* Version information\r
\r
- ```\r
+ ```bash\r
root@proxy:~# docker version\r
Client:\r
Version: 1.12.6\r
Git commit: 78d1802\r
Built: Tue Jan 31 23:35:14 2017\r
OS/Arch: linux/amd64\r
-\r
+ \r
Server:\r
Version: 1.12.6\r
API version: 1.24\r
OS/Arch: linux/amd64\r
```\r
\r
-### [kubernetes](https://github.com/kubernetes/kubernetes) local cluster\r
+### [golang](https://redirector.gvt1.com/edgedl/go/go1.9.2.linux-amd64.tar.gz) \r
* Version information\r
+\r
+ ```bash\r
+ root@proxy:~# go version\r
+ go version go1.9.2 linux/amd64\r
```\r
+\r
+* You can install golang by executing commands blow:\r
+\r
+ ```bash\r
+ wget https://storage.googleapis.com/golang/go1.9.2.linux-amd64.tar.gz\r
+ tar -C /usr/local -xzf go1.9.2.linux-amd64.tar.gz\r
+ export PATH=$PATH:/usr/local/go/bin\r
+ export GOPATH=$HOME/gopath\r
+ ```\r
+\r
+### [kubernetes](https://github.com/kubernetes/kubernetes) local cluster\r
+* Version information\r
+ ```bash\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
+ ```bash\r
cd $HOME\r
git clone https://github.com/kubernetes/kubernetes.git\r
cd $HOME/kubernetes\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
+**NOTE**: \r
+<div> Due to opensds using etcd as the database which is same with kubernetes so you should startup kubernetes firstly.\r
+</div>\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```.\r
+* 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
\r
## Testing steps ##\r
+* Load some ENVs which is setted before.\r
\r
-* Create service account, role and bind them.\r
+ ```bash\r
+ source /etc/profile\r
+ ```\r
+* Download nbp source code.\r
+\r
+ using git clone \r
+ ```bash\r
+ git clone https://github.com/opensds/nbp.git $GOPATH/src/github.com/opensds/nbp\r
+ ```\r
+ \r
+ or using go get \r
+ ```bash\r
+ go get -v github.com/opensds/nbp/...\r
+ ``` \r
+\r
+* Build the FlexVolume.\r
+\r
+ ```bash\r
+ cd $GOPATH/src/github.com/opensds/nbp/flexvolume\r
+ go build -o opensds ./cmd/flex-plugin/\r
```\r
- cd /opt/opensds-k8s-{release version}-linux-amd64/provisioner\r
+ \r
+ FlexVolume plugin binary is on the current directory. \r
+\r
+\r
+* Copy the OpenSDS FlexVolume binary file to k8s kubelet `volume-plugin-dir`. \r
+ if you don't specify the `volume-plugin-dir`, you can execute commands blow:\r
+\r
+ ```bash\r
+ mkdir -p /usr/libexec/kubernetes/kubelet-plugins/volume/exec/opensds.io~opensds/\r
+ cp $GOPATH/src/github.com/opensds/nbp/flexvolume/opensds /usr/libexec/kubernetes/kubelet-plugins/volume/exec/opensds.io~opensds/\r
+ ``` \r
+ \r
+ **NOTE**: \r
+ <div>\r
+ 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
+</div>\r
+\r
+* Build the provisioner docker image.\r
+\r
+ ```bash\r
+ cd $GOPATH/src/github.com/opensds/nbp/opensds-provisioner\r
+ make container\r
+ ```\r
+\r
+* Create service account, role and bind them.\r
+ ```bash\r
+ cd $GOPATH/src/github.com/opensds/nbp/opensds-provisioner/examples\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
+* 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
serviceAccount: opensds-provisioner\r
containers:\r
- name: opensds-provisioner\r
- image: opensdsio/opensds-provisioner:latest\r
+ image: opensdsio/opensds-provisioner\r
securityContext:\r
args:\r
- "-endpoint=http://192.168.56.106:50040" # should be replaced\r
```\r
\r
* Create provisioner pod.\r
- ```\r
+ ```bash\r
kubectl create -f pod-provisioner.yaml\r
```\r
-\r
+ \r
+ Execute `kubectl get pod` to check if the opensds-provisioner is ok.\r
+ ```bash\r
+ root@nbp:~/go/src/github.com/opensds/nbp/opensds-provisioner/examples# kubectl get pod\r
+ NAME READY STATUS RESTARTS AGE\r
+ opensds-provisioner 1/1 Running 0 42m\r
+ ```\r
* You can use the following cammands to test the OpenSDS FlexVolume and Proversioner functions.\r
\r
- ```\r
+ Create storage class.\r
+ ```bash\r
kubectl create -f sc.yaml # Create StorageClass\r
+ ```\r
+ Execute `kubectl get sc` to check if the storage class is ok. \r
+ ```bash\r
+ root@nbp:~/go/src/github.com/opensds/nbp/opensds-provisioner/examples# kubectl get sc\r
+ NAME PROVISIONER AGE\r
+ opensds opensds/nbp-provisioner 46m\r
+ standard (default) kubernetes.io/host-path 49m\r
+ ```\r
+ Create PVC.\r
+ ```bash\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
+ Execute `kubectl get pvc` to check if the pvc is ok. \r
+ ```bash\r
+ root@nbp:~/go/src/github.com/opensds/nbp/opensds-provisioner/examples# kubectl get pvc\r
+ NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE\r
+ opensds-pvc Bound 731da41e-c9ee-4180-8fb3-d1f6c7f65378 1Gi RWO opensds 48m\r
\r
+ ```\r
+ Create busybox pod.\r
+ \r
+ ```bash\r
+ kubectl create -f pod-application.yaml # Create busybox pod and mount the block storage.\r
+ ```\r
+ Execute `kubectl get pod` to check if the busybox pod is ok. \r
+ ```bash\r
+ root@nbp:~/go/src/github.com/opensds/nbp/opensds-provisioner/examples# kubectl get pod\r
+ NAME READY STATUS RESTARTS AGE\r
+ busy-pod 1/1 Running 0 49m\r
+ opensds-provisioner 1/1 Running 0 50m\r
+ ```\r
Execute the `findmnt|grep opensds` to confirm whether the volume has been provided.\r
+ If there is some thing that goes wrong, you can check the log files in directory `/var/log/opensds`.\r
\r
## Clean up steps ##\r
\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
+```\r