MinIO 是全球領(lǐng)先的對象存儲先鋒势就,以 Apache License v2.0 發(fā)布的對象存儲服務(wù)器,是為云應(yīng)用和虛擬機(jī)而設(shè)計的分布式對象存儲服務(wù)器。在標(biāo)準(zhǔn)硬件上洋腮,讀/寫速度上高達(dá)183GB/s和171GB/s。它與 Amazon S3 云存儲服務(wù)兼容手形。 它最適用于存儲非結(jié)構(gòu)化數(shù)據(jù)啥供,如照片、視頻库糠、日志文件伙狐、備份和容器/虛擬機(jī)映像。 對象的大小可以從幾KB 到最大5TB瞬欧。
- 對象存儲贷屎,兼容Amazon S3協(xié)議
- 安裝運維相對簡單,開箱即用
- 后端除了本地文件系統(tǒng)黍判,還支持多種存儲系統(tǒng)豫尽,目前已經(jīng)包括 OSS
- 原生支持bucket事件通知機(jī)制
- 可通過多節(jié)點集群方式,支持一定的高可用和數(shù)據(jù)容災(zāi)
- 有WEB管理界面和CLI顷帖,可以用于測試或者管理
- 公開bucket中的數(shù)據(jù)可以直接通過HTTP獲取
MinIO是一個非常輕量的服務(wù),可以很簡單的和其他應(yīng)用的結(jié)合美旧,類似 NodeJS, Redis 或者 MySQL。
MinIO支持多種靈活的部署方式贬墩,支持Docker Compose榴嗅、Docker Swam、Kubernetes等陶舞,詳見官網(wǎng):https://docs.min.io/docs/minio-deployment-quickstart-guide.html或者https://min.io/download#/linux
這里著重介紹K8S下部署
1嗽测、standalone模式
apiVersion: v1
kind: PersistentVolume
metadata:
labels:
app: minio
release: minio
name: minio
namespace: default
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 10Gi
volumeMode: Filesystem
hostPath:
path: /mnt/minio
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
# This name uniquely identifies the PVC. Will be used in deployment below.
name: minio-pv-claim
labels:
app: minio-storage-claim
spec:
# Read more about access modes here: https://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
# Uncomment and add storageClass specific to your requirements below. Read more https://kubernetes.io/docs/concepts/storage/persistent-volumes/#class-1
#storageClassName:
---
apiVersion: apps/v1
kind: Deployment
metadata:
# This name uniquely identifies the Deployment
name: minio-deployment
spec:
strategy:
type: Recreate
selector:
matchLabels:
app: minio
template:
metadata:
labels:
# Label is used as selector in the service.
app: minio
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
args:
- server
- /storage
env:
# MinIO access key and secret key
- name: MINIO_ACCESS_KEY
value: "admin123"
- name: MINIO_SECRET_KEY
value: "admin123"
ports:
- containerPort: 9000
# Mount the volume into the pod
volumeMounts:
- name: storage # must match the volume name, above
mountPath: "/storage"
---
apiVersion: v1
kind: Service
metadata:
name: minio-service
spec:
type: NodePort
ports:
- port: 9000
targetPort: 9000
protocol: TCP
selector:
app: minio
由于service采用NodePort類型,通過主機(jī)IP:32593訪問web
2肿孵、distributed模式
apiVersion: v1
kind: Service
metadata:
name: minio
labels:
app: minio
spec:
clusterIP: None
ports:
- port: 9000
name: minio
selector:
app: minio
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: minio
spec:
serviceName: minio
replicas: 4
selector:
matchLabels:
app: minio
template:
metadata:
labels:
app: minio
spec:
containers:
- name: minio
env:
- name: MINIO_ACCESS_KEY
value: "admin123"
- name: MINIO_SECRET_KEY
value: "admin123"
image: minio/minio
args:
- server
- http://minio-{0...3}.minio.default.svc.cluster.local/data
ports:
- containerPort: 9000
# These volume mounts are persistent. Each pod in the PetSet
# gets a volume mounted based on this field.
volumeMounts:
- name: data
mountPath: /data
# These are converted to volume claims by the controller
# and mounted at the paths mentioned above.
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
# Uncomment and add storageClass specific to your requirements below. Read more https://kubernetes.io/docs/concepts/storage/persistent-volumes/#class-1
#storageClassName:
---
apiVersion: v1
kind: Service
metadata:
name: minio-service
spec:
type: NodePort
ports:
- port: 9000
targetPort: 9000
protocol: TCP
selector:
app: minio
分布式部署唠粥,實例數(shù)至少4個,所以需要另外創(chuàng)建4個pv