Added detailed steps

This commit is contained in:
Nitish 2017-02-14 14:19:21 +05:30
parent 9ee4b63bd7
commit 0a580596ab

View File

@ -4,16 +4,18 @@
- [Introduction](#introduction) - [Introduction](#introduction)
- [Prerequisites](#prerequisites) - [Prerequisites](#prerequisites)
- [Get Started](#get-started) - [Quickstart](#quickstart)
- [Step 1: Create Persistent Volume Claim](#step1-create-persistent-volume-claim)
- [Step 2: Create Deployment](#step2-create-deployment)
- [Step 3: Create LoadBalancer Service](#step3-create-loadbalancer-service)
- [Step 4: Resource cleanup](#step4-resource-cleanup)
## Introduction ## Introduction
Minio is an AWS S3 compatible, object storage server built for cloud applications and devops. Minio is an AWS S3 compatible, object storage server built for cloud applications and devops. Minio is _cloud native_, meaning Minio understands that it is running within a cluster manager, and uses the cluster management infrastructure for allocation of compute and storage resources.
The following document describes the process to deploy [Minio](https://minio.io/) on Kubernetes. Minio is a _cloud native_ application, meaning The following document describes the process to deploy standalone [Minio](https://minio.io/) server on Kubernetes. The deployment uses the [official Minio Docker image](https://hub.docker.com/r/minio/minio/~/dockerfile/) from Docker Hub.
Minio understands that it is running within a cluster manager, and uses this cluster management infrastructure for allocation of compute and storage
resources.
The pods use the [official Minio Docker image](https://hub.docker.com/r/minio/minio/~/dockerfile/) from Docker Hub. This example uses some of the core components of Kubernetes: This example uses some of the core components of Kubernetes:
- [_Pods_](https://kubernetes.io/docs/user-guide/pods/) - [_Pods_](https://kubernetes.io/docs/user-guide/pods/)
- [_Services_](https://kubernetes.io/docs/user-guide/services/) - [_Services_](https://kubernetes.io/docs/user-guide/services/)
@ -22,34 +24,170 @@ The pods use the [official Minio Docker image](https://hub.docker.com/r/minio/mi
## Prerequisites ## Prerequisites
This example assumes that you have a Kubernetes version >=1.4 cluster installed and running, This example assumes that you have a Kubernetes version >=1.4 cluster installed and running, and that you have installed the [`kubectl`](../../../docs/user-guide/kubectl/kubectl.md)
and that you have installed the [`kubectl`](../../../docs/user-guide/kubectl/kubectl.md)
command line tool somewhere in your path. Please see the command line tool somewhere in your path. Please see the
[getting started guides](../../../docs/getting-started-guides/) [getting started guides](../../../docs/getting-started-guides/)
for installation instructions for your platform. for installation instructions for your platform.
## Get Started ## Quickstart
But before creating the deployment, you need to create a persistent volume claim (PVC) to request storage for the Minio instance. Kubernetes looks out for PVs matching the PVC request in the cluster and binds it to the PVC automatically. Create a PersistentVolumeClaim by downloading the file [minio-standalone-pvc.yaml] (minio-standalone-pvc.yaml?raw=true) and running Run the below commands to get started quickly
```sh
kubectl create -f examples/storage/minio/minio-standalone-pvc.yaml
kubectl create -f examples/storage/minio/minio-standalone-deployment.yaml
kubectl create -f examples/storage/minio/minio-standalone-service.yaml
```
## Step 1: Create Persistent Volume Claim
Minio needs persistent storage to store objects. If there is no
persistent storage, the data stored in Minio instance will be stored in the container file system and will be wiped off as soon as the container restarts.
Create a persistent volume claim (PVC) to request storage for the Minio instance. Kubernetes looks out for PVs matching the PVC request in the cluster and binds it to the PVC automatically.
This is the PVC description.
```sh
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
# This name uniquely identifies the PVC. Will be used in deployment below.
name: minio-pv-claim
annotations:
volume.alpha.kubernetes.io/storage-class: anything
labels:
app: minio-storage-claim
spec:
# Read more about access modes here: http://kubernetes.io/docs/user-guide/persistent-volumes/#access-modes
accessModes:
- ReadWriteOnce
resources:
# This is the request for storage. Should be available in the cluster.
requests:
storage: 10Gi
```
[Download example] (minio-standalone-pvc.yaml?raw=true)
Create the PersistentVolumeClaim
```sh ```sh
kubectl create -f minio-standalone-pvc.yaml kubectl create -f minio-standalone-pvc.yaml
``` ```
The response should be like this:
A deployment encapsulates replica sets and podsso, if a pod goes down, replication controller makes sure another pod comes up automatically. This way you wont need to bother about pod failures and will have a stable Minio service available. Create the Minio Deployment by downloading the file [minio-standalone-deployment.yaml] (minio-standalone-deployment.yaml?raw=true) and running ```sh
persistentvolumeclaim "minio-pv-claim" created
```
# Step 2: Create Minio Deployment
A deployment encapsulates replica sets and podsso, if a pod goes down, replication controller makes sure another pod comes up automatically. This way you wont need to bother about pod failures and will have a stable Minio service available.
This is the deployment description.
```sh
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
# This name uniquely identifies the Deployment
name: minio-deployment
spec:
strategy:
type: Recreate
template:
metadata:
labels:
# Label is used as selector in the service.
app: minio-server
spec:
# Refer to the PVC created earlier
volumes:
- name: storage
persistentVolumeClaim:
# Name of the PVC created earlier
claimName: minio-pv-claim
containers:
- name: minio
# Pulls the default Minio image from Docker Hub
image: minio/minio
command: ["minio"]
args: ["server", "/storage"]
env:
# Minio access key and secret key
- name: MINIO_ACCESS_KEY
value: "minio"
- name: MINIO_SECRET_KEY
value: "minio123"
ports:
- containerPort: 9000
hostPort: 9000
# Mount the volume into the pod
volumeMounts:
- name: storage # must match the volume name, above
mountPath: "/storage"
```
[Download example] (minio-standalone-deployment.yaml?raw=true)
Create the Deployment
```sh ```sh
kubectl create -f minio-standalone-deployment.yaml kubectl create -f minio-standalone-deployment.yaml
``` ```
The response should be like this
```sh
deployment "minio-deployment" created
```
# Step 3: Create Minio Service
Now that you have a Minio deployment running, you may either want to access it internally (within the cluster) or expose it as a Service onto an external (outside of your cluster, maybe public internet) IP address, depending on your use case. You can achieve this using Services. There are 3 major service typesdefault type is ClusterIP, which exposes a service to connection from inside the cluster. NodePort and LoadBalancer are two types that expose services to external traffic. Now that you have a Minio deployment running, you may either want to access it internally (within the cluster) or expose it as a Service onto an external (outside of your cluster, maybe public internet) IP address, depending on your use case. You can achieve this using Services. There are 3 major service typesdefault type is ClusterIP, which exposes a service to connection from inside the cluster. NodePort and LoadBalancer are two types that expose services to external traffic.
In this example, we expose the Minio Deployment by creating a LoadBalancer service. Download the file [minio-standalone-service.yaml] (minio-standalone-service.yaml?raw=true) and running In this example, we expose the Minio Deployment by creating a LoadBalancer service. This is the service description.
```sh
apiVersion: v1
kind: Service
metadata:
name: minio-service
spec:
type: LoadBalancer
ports:
- port: 9000
targetPort: 9000
protocol: TCP
selector:
app: minio-server
```
[Download example] (minio-standalone-service.yaml?raw=true)
```sh ```sh
kubectl create -f minio-standalone-service.yaml kubectl create -f minio-standalone-service.yaml
``` ```
The response should be like this
```sh
service "minio-service" created
```
To check if the service was created successfully, run the command
```sh
kubectl get svc minio-service
```
You should get a response like this
```sh
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
minio-service 10.55.248.23 104.199.249.165 9000:31852/TCP 1m
```
# Step 4: Resource cleanup
Once you are done, cleanup the cluster using Once you are done, cleanup the cluster using
```sh ```sh
kubectl delete deployment minio-deployment \ kubectl delete deployment minio-deployment \