Skip to content

OpenSDS Integration with Kubernetes CSI

Ashit Kumar edited this page Jan 7, 2021 · 14 revisions

Prerequisite

Ubuntu

version information:

root@proxy:~# cat /etc/issue
Ubuntu 16.04.2 LTS \n \l

Environment packages

apt-get update && apt-get install -y gcc make libc6-dev

Install Go (v1.12.1)

wget https://storage.googleapis.com/golang/go1.12.1.linux-amd64.tar.gz
tar -C /usr/local -zxvf go1.12.1.linux-amd64.tar.gz   
echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile  
echo 'export GOPATH=$HOME/gopath' >> /etc/profile  
source /etc/profile

Docker

version information:

root@ubuntu:~# docker version
Client:
 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        e68fc7a
 Built:             Tue Aug 21 17:24:56 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.1-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       e68fc7a
  Built:            Tue Aug 21 17:23:21 2018
  OS/Arch:          linux/amd64
  Experimental:     false

You can install docker using these commands below:

wget https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/docker-ce_18.06.1~ce~3-0~ubuntu_amd64.deb
dpkg -i docker-ce_18.06.1~ce~3-0~ubuntu_amd64.deb 

Kubernetes local cluster

You can startup v1.14.0 k8s local cluster by executing commands blow:

cd $HOME && git clone https://github.com/kubernetes/kubernetes.git
cd $HOME/kubernetes && git checkout v1.14.0
make
echo alias kubectl='$HOME/kubernetes/cluster/kubectl.sh' >> /etc/profile
hack/install-etcd.sh
ENABLE_DAEMON=true ALLOW_PRIVILEGED=true FEATURE_GATES=VolumeSnapshotDataSource=true RUNTIME_CONFIG="storage.k8s.io/v1alpha1=true" LOG_LEVEL=5 hack/local-up-cluster.sh -O

OpenSDS local cluster

For testing purposes you can deploy OpenSDS refering to OpenSDS Cluster Installation through Ansible.

Testing steps

  • Change the workplace

     cd /opt/opensds-sushi-linux-amd64
    
  • Update profile id of StorageClass in nginx.yml according to actual profile you created, it looks like this:

     apiVersion: storage.k8s.io/v1
         kind: StorageClass
         metadata:
           name: csi-sc-opensdsplugin
         provisioner: csi-opensdsplugin
         parameters:
           attachMode: rw
           profile: d10ec339-3357-43ff-8626-4ccdb854af3d
    
  • Create example nginx application

     kubectl create -f csi/examples/kubernetes/nginx.yaml
    

    This example will mount a opensds volume into /var/lib/www/html.

    You can use the following command to inspect into nginx container to verify it.

     docker exec -it <nginx container id> /bin/bash
    

Clean up steps

Clean up example nginx application and opensds CSI pods by the following commands:

kubectl delete -f csi/examples/kubernetes/nginx.yaml
kubectl delete -f csi/deploy/kubernetes