此文档用于记录k8s中安装minio的过程
使用helm安装minio
1
2
3
4
5
|
# 分布式部署 需要提前创建好storageClass
$ helm install minio stable/minio -n minio --set mode=distributed,numberOfNodes=4,persistence.size=20Gi,service.type=NodePort,service.nodePort=33900,persistence.storageClass=minio,accessKey=admin,secretKey=admin000
# 单点部署
$ helm install minio stable/minio -n minio
|
参数说明:
- mode:MinIO server模式 (
standalone
, shared
或者 distributed
) 默认值:standalone
- numberOfNodes: 节点数 (仅对分布式模式生效). 可选值 4 <= x <= 16 默认值为4
- persistence.size:持久卷大小 默认值:10Gi
- service.type: 服务类型 默认为LoadBalancer
- service.nodePort: 指定NodePort的端口
- persistence.storageClass: storageClass名字 默认为generic
- accessKey: 用户名 默认:AKIAIOSFODNN7EXAMPLE
- secretKey: 密码 默认:wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
使用yaml安装
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
$ vim minio.yaml
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
template:
metadata:
labels:
app: minio
spec:
containers:
- name: minio
env:
- name: MINIO_ACCESS_KEY
value: "admin"
- 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: 500Gi
# Uncomment and add storageClass specific to your requirements below. Read more https://kubernetes.io/docs/concepts/storage/persistent-volumes/#class-1
storageClassName: minio
---
apiVersion: v1
kind: Service
metadata:
name: minio-service
spec:
type: NodePort
ports:
- port: 9000
targetPort: 9000
nodePort: 39000
protocol: TCP
selector:
app: minio
$ kubectl apply -f minio.yaml -n minio
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
$ vim minio.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: 500Gi
# Uncomment and add storageClass specific to your requirements below. Read more https://kubernetes.io/docs/concepts/storage/persistent-volumes/#class-1
storageClassName: minio
---
apiVersion: extensions/v1
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
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: "admin"
- 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
nodePort: 39000
protocol: TCP
selector:
app: minio
$ kubectl apply -f minio.yaml -n minio
|
参考链接:
https://min.io/download#/kubernetes
https://docs.min.io/cn/deploy-minio-on-kubernetes.html
Author
dylan
LastMod
2021-03-12
License
如需转载请注明文章作者和出处。谢谢!