Deploying highly scalable cloud storage with Rook - Part 2 (Minio Storage)
Tags: docker, devops
Published: 2020-05-19 20:34:19

Last time we talked about deploying a Ceph cluster with block storage using Rook. Today we are going to dive into discussing a different type of storage method that Rook provides and what it's use case and benefits are. 

#What is MinIO?#

MinIO is a high performance object store that is compatible with Amazon S3 and is native to the technologies and architectures that define the cloud. These technologies include containerization, orchestration with Kubernetes, microservices and multi-tenancy. No other object store is more Kubernetes-friendly. 

MinIO is 100% open source under the Apache V2 license. This means that MinIO’s customers are free from lock in, free to inspect, free to innovate, free to modify and free to redistribute.

One of the many options for cloud-native storage solutions that Rook provides is object-storage with MinIO. Let us go through a demonstration of how we would go about deploying MinIO with Rook to a K8s cluster.

#Deploying MinIO with Rook#

MinIO is a high performance distributed object storage server, designed for large-scale private cloud infrastructure. Rook provides an operator to deploy and manage MinIO clusters.

###Prerequisites###

A Kubernetes cluster is necessary to run the Rook MinIO operator. To make sure you have a Kubernetes cluster that is ready for `Rook`, you can [follow these instructions](https://rook.io/docs/rook/v1.2/k8s-pre-reqs.html).

###Deploy the MinIO Operator###

First deploy the Rook MinIO operator using the following commands:

```
git clone --single-branch --branch release-1.2 https://github.com/rook/rook.git
cd cluster/examples/kubernetes/minio
kubectl create -f operator.yaml
```

You can check if the operator is up and running with:

```
kubectl -n rook-minio-system get pod
```

###Create and Initialize a Distributed MinIO Object Store###

Now that the operator is running, we can create an instance of a distributed MinIO object store by creating an instance of the `objectstore.minio.rook.io` resource. Some of that resource’s values are configurable, so feel free to browse `object-store.yaml` and tweak the settings to your liking.

It is **strongly recommended** to update the values of `accessKey` and `secretKey` in `object-store.yaml` to a secure key pair, as described in the [MinIO client quickstart guide](https://docs.minio.io/docs/minio-client-quickstart-guide).

When you are ready to create a MinIO object store, simply run:

```
kubectl create -f object-store.yaml
```

We can verify that a Kubernetes object has been created that represents our new MinIO object store with the command below. This is important because it shows that Rook has successfully extended Kubernetes to make MinIO object stores a first class citizen in the Kubernetes cloud-native environment.

```
kubectl -n rook-minio get objectstores.minio.rook.io
```

To check if all the desired replicas are running, you should see the same number of entries from the following command as the replica count that was specified in `object-store.yaml`:

```
kubectl -n rook-minio get pod -l app=minio,objectstore=my-store
```

###Accessing the Object Store###

MinIO comes with an embedded web based object browser. In the example, the object store we have created can be exposed external to the cluster at the Kubernetes cluster IP via a “NodePort”. We can see which port has been assigned to the service via:

```
kubectl -n rook-minio get service minio-my-store -o jsonpath='{.spec.ports[0].nodePort}'
```

If you are using [Minikube](https://github.com/kubernetes/minikube), you can get your cluster IP via `minikube ip`. The full address of the MinIO service when using Minikube can be obtained with the following:

```
echo http://$(minikube ip):$(kubectl -n rook-minio get service minio-my-store -o jsonpath='{.spec.ports[0].nodePort}')
```

Copy-paste the full address and port into an internet browser and you will be taken to the MinIO web console login page, as shown in the screenshot below:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/y4hmr7nkwar4t6zf2xxb.png)

###Clean up###

To clean up all resources associated with this walk-through, you can run the commands below.

**NOTE**: This will destroy your MinIO object store and delete all of its associated data.

```
kubectl delete -f object-store.yaml
kubectl delete -f operator.yaml
```

###Troubleshooting###

If the MinIO cluster does not come up, the first step would be to examine the operator’s logs:

```
kubectl -n rook-minio-system logs -l app=rook-minio-operator
```

If everything looks OK in the operator logs, you can also look in the logs for one of the MinIO instances. Assuming your `object-store.yaml` file named it “my-store”, each node in the cluster can be inspected via:

```
kubectl -n rook-minio logs my-store-0
```

Feel free to modify the above to inspect other instances.

#Moving on#

In the next part of this series, we are going to go over the steps and benefits of deploying a CockroachDB storage solution with Rook. See you then!