背景概況
MinIO 是全球領(lǐng)先的對象存儲(chǔ)先鋒漱病,以 Apache License v2.0 發(fā)布的對象存儲(chǔ)服務(wù)器,是為云應(yīng)用和虛擬機(jī)而設(shè)計(jì)的分布式對象存儲(chǔ)服務(wù)器。在標(biāo)準(zhǔn)硬件上,讀/寫速度上高達(dá)183GB/s和171GB/s排宰。它與 Amazon S3 云存儲(chǔ)服務(wù)兼容。 它最適用于存儲(chǔ)非結(jié)構(gòu)化數(shù)據(jù)那婉,如照片板甘、視頻、日志文件详炬、備份和容器/虛擬機(jī)映像盐类。 對象的大小可以從幾KB 到最大5TB。
- 對象存儲(chǔ),兼容Amazon S3協(xié)議
- 安裝運(yùn)維相對簡單在跳,開箱即用
- 后端除了本地文件系統(tǒng)枪萄,還支持多種存儲(chǔ)系統(tǒng),目前已經(jīng)包括 OSS
- 原生支持bucket事件通知機(jī)制
- 可通過多節(jié)點(diǎn)集群方式猫妙,支持一定的高可用和數(shù)據(jù)容災(zāi)
- 有WEB管理界面和CLI瓷翻,可以用于測試或者管理
- 公開bucket中的數(shù)據(jù)可以直接通過HTTP獲取
Minio 資源
# 項(xiàng)目工作展示目錄
cd /home/work/minio-demo/
- minio-deployment.yaml
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"
- minio-pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
labels:
app: minio
release: minio
name: minio
namespace: default
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 20Gi
volumeMode: Filesystem
hostPath:
path: /mnt/minio
- minio-pvc.yaml
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: 20Gi
# Uncomment and add storageClass specific to your requirements below. Read more https://kubernetes.io/docs/concepts/storage/persistent-volumes/#class-1
# storageClassName: minio
- minio-svc.yaml
apiVersion: v1
kind: Service
metadata:
name: minio-service
spec:
type: NodePort
ports:
- port: 9000
targetPort: 9000
protocol: TCP
selector:
app: minio
- minio-ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: traefik-minio
namespace: default
annotations:
kubernetes.io/ingress.class: traefik
spec:
rules:
- host: traefik.minio-minio-standalone.io
http:
paths:
- backend:
serviceName: minio-service
servicePort: 9000
資源創(chuàng)建過程:
# 創(chuàng)建pv
kubectl apply -f minio-pv.yaml
# 創(chuàng)建pvc
kubectl apply -f minio-pv.yaml
# 創(chuàng)建deployment
kubectl apply -f minio-deployment.yaml
# 創(chuàng)建service
kubectl apply -f minio-svc.yaml
# 創(chuàng)建ingress
kubectl apply -f minio-ingress.yaml
Helm 改造
資源改造目錄如下:
[root@vm3290 helm]# tree minio-standalone/
minio-standalone/
├── Chart.yaml
├── README.md
├── templates
│ ├── minio-deployment.yaml
│ ├── minio-ingress.yaml
│ ├── minio-pvc.yaml
│ ├── minio-pv.yaml
│ └── minio-svc.yaml
└── values.yaml
1 directory, 8 files
定義 values.yaml 內(nèi)容如下:
replicas: 1
strategy: Recreate
resources:
limits:
cpu: "1"
memory: 1Gi
requests:
cpu: 200m
memory: 200Mi
pv:
name: minio
accessModes: ReadWriteOnce
storage: 20Gi
pvc:
name: minio-pv-claim
service:
name: minio-service
ingress:
name: minio-ingress
host: traefik.minio-minio-standalone.io
# 請不要輕易修改此配置
global:
namespace: minio-ns
minio:
name: minio-ds
image: minio/minio
tag: latest
port: 9000
項(xiàng)目部署
1. 安裝
helm install -n <YOUR-NAMESPACE> standalone standalone
2. 更新
helm upgrade -n <YOUR-NAMESPACE> standalone standalone
3. 卸載
helm delete -n <YOUR-NAMESPACE> standalone
minio 部署資源查看
配置 hosts 文件:
瀏覽器打開訪問:
拓展閱讀
本次改造的 minio 是單實(shí)例節(jié)點(diǎn)副本的 helm 化改造,主要用于機(jī)器資源不足割坠,沒有進(jìn)行全盤虛擬化的場景下的資源調(diào)度管理上的應(yīng)用部署齐帚,針對應(yīng)用的場景不同,所以需要結(jié)合不同的項(xiàng)目需求進(jìn)行設(shè)計(jì)彼哼。minio 可以支持單實(shí)例副本对妄,同時(shí)也支持最小的四節(jié)點(diǎn)集群模式(所以在資源較少時(shí)建議采用單副本的minio,在集群中可以調(diào)度的機(jī)器節(jié)點(diǎn)資源大于等于4時(shí),minio的集群模式才可以正常使用沪羔,后續(xù)將會(huì)開展集群模式的改造部署)