背景概況
MinIO 是全球領(lǐng)先的對(duì)象存儲(chǔ)先鋒衫仑,以 Apache License v2.0 發(fā)布的對(duì)象存儲(chǔ)服務(wù)器,是為云應(yīng)用和虛擬機(jī)而設(shè)計(jì)的分布式對(duì)象存儲(chǔ)服務(wù)器。在標(biāo)準(zhǔn)硬件上,讀/寫速度上高達(dá)183GB/s和171GB/s褒脯。它與 Amazon S3 云存儲(chǔ)服務(wù)兼容。 它最適用于存儲(chǔ)非結(jié)構(gòu)化數(shù)據(jù)缆毁,如照片番川、視頻、日志文件脊框、備份和容器/虛擬機(jī)映像爽彤。 對(duì)象的大小可以從幾KB 到最大5TB。
對(duì)象存儲(chǔ)缚陷,兼容Amazon S3協(xié)議
安裝運(yùn)維相對(duì)簡單适篙,開箱即用
后端除了本地文件系統(tǒng),還支持多種存儲(chǔ)系統(tǒng)箫爷,目前已經(jīng)包括 OSS
原生支持bucket事件通知機(jī)制
可通過多節(jié)點(diǎn)集群方式嚷节,支持一定的高可用和數(shù)據(jù)容災(zāi)
有WEB管理界面和CLI,可以用于測試或者管理
公開bucket中的數(shù)據(jù)可以直接通過HTTP獲取
集群模式要求: 集群可以調(diào)度資源節(jié)點(diǎn) >=4
集群資源不足時(shí)部署參考: https://www.cnblogs.com/vpc123/articles/14346984.html
Minio 資源
# 項(xiàng)目工作展示目錄
cd /home/work/minio-demo/
- minio-statefulset.yaml
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:
- minio-svc.yaml
apiVersion: v1
kind: Service
metadata:
name: minio
labels:
app: minio
spec:
clusterIP: None
ports:
- port: 9000
name: minio
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-distributed.io
http:
paths:
- backend:
serviceName: minio
servicePort: 9000
- minio-nodeport.yaml
apiVersion: v1
kind: Service
metadata:
name: minio-service
spec:
type: NodePort
ports:
- port: 9000
targetPort: 9000
protocol: TCP
selector:
app: minio
資源創(chuàng)建過程:
# 創(chuàng)建StatefulSet
kubectl apply -f minio-statefulset.yaml
# 創(chuàng)建service
kubectl apply -f minio-svc.yaml
# 創(chuàng)建ingress
kubectl apply -f minio-ingress.yaml
# 創(chuàng)建nodeport
kubectl apply -f minio-nodeport.yaml
Helm 改造
資源改造目錄如下:
[root@vm3290 helm]# tree minio-distributed/
minio-distributed/
├── Chart.yaml
├── README.md
├── templates
│ ├── minio-ingress.yaml
│ ├── minio-nodeport.yaml
│ ├── minio-statefulset.yaml
│ ├── minio-svc.yaml
│ ├── NOTES.txt
│ └── tests
│ └── test-connection.yaml
└── values.yaml
2 directories, 9 files
定義 values.yaml 內(nèi)容如下:
replicas: 4
strategy: Recreate
resources:
limits:
cpu: "1"
memory: 1Gi
requests:
cpu: 200m
memory: 200Mi
pv:
accessModes: ReadWriteOnce
storage: 5Gi
service:
name: minio-service
nodeport: minio-node
ingress:
name: minio-ingress
host: traefik.minio-distributed.io
# 請(qǐng)不要輕易修改此配置
global:
namespace: minio-ss
minio:
name: minio-ss
image: minio/minio
tag: latest
port: 9000
項(xiàng)目部署
1. 安裝
helm install -n <YOUR-NAMESPACE> minio-distributed minio-distributed
2. 更新
helm upgrade -n <YOUR-NAMESPACE> minio-distributed minio-distributed
3. 卸載
helm delete -n <YOUR-NAMESPACE> minio-distributed
配置 hosts 文件:
瀏覽器打開訪問: