Setup and playing with rook storage with minikube
Here I present the second part in my introduction practical guide of setting up and playing with Kubernetes on virtual machines (VM) in VirtualBox. In the second part, I will explain how to use rook storage orchestrator with k8s.
Setup rook storage using k8s manifests
Rook is an open source storage orchestrator for Kubernetes. You can find more information about rook on its official github page or in rook manual. Let’s deploy it on our minikube cluster.
Firstly start minikube:
sudo -E minikube start -vm-driver=none
Clone rook repo and open examples:
git clone https://github.com/rook/rook.gitcd rook/cluster/examples/kubernetes/ceph
Now having a cluster running we can setup and deploy rook using special rook-operator deployment specified in operator.yaml file. Let’s use example yaml file provided in the rook repo:
kubectl create -f operator.yaml
Then create a cluster for rook:
kubectl create -f cluster.yaml
Now we need to consume the rook storage. We will create a rook client. Create the client pod rook-client.yaml:
apiVersion: v1
kind: Pod
metadata:
name: rook-client
namespace: rook-ceph
spec:
containers:
- name: rook-client
image: quay.io/rook/rook-client:latest
imagePullPolicy: IfNotPresent
command: ["sleep", "36500d"]
securityContext:
privileged: true
volumeMounts:
- mountPath: /dev
name: dev
- mountPath: /sys
name: sys
- mountPath: /lib/modules
name: libmodules
volumes:
- name: dev
hostPath:
path: /dev
- name: sys
hostPath:
path: /sys
- name: libmodules
hostPath:
path: /lib/modules
Then start client:
kubectl create -f rook-client.yml
Now we can connect to the container rook-client in the k8s dashboard. Run the k8s dashboard:
minikube dashboard
Open the pod called rook-client in the Dashboard and click link Exec in the top menu:
Now we are ready to manage our Rook cluster. List the nodes in the cluster using command:
rook node ls
Get the cluster status:
rook status
To list all options use help option:
rook --help
Install rook using helm operator
Another way to install rook is using helm operator. helm is a package manager for Kubernetes. Firstly install helm. We can install it easily using the the Snap package manager:
sudo snap install helm
Now install rook using helm charts:
$ helm repo add rook-master https://charts.rook.io/master
$ helm install rook-master/rook-ceph --wait --namespace rook-ceph-system --name my-rook --version $(helm search rook-ceph | awk "/^rook-master/ { print \$2 }")
That’s all. Enjoy Kubernetes and rook!