k8s安装minio
安装好后浏览器访问ui,登录密码admin和root123456ip:30500创建buckets,例如创建名字最少3位数,例如hhh,然后上传图片,支持在线预览,设置公有属性所有人可以访问图片ip:30900/hhh/图片名称注意。
·
单机版安装
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: minio
spec:
replicas: 1
selector:
matchLabels:
app: minio
template:
metadata:
labels:
app: minio
spec:
containers:
- name: minio
env:
- name: MINIO_ROOT_USER
value: "admin"
- name: MINIO_ROOT_PASSWORD
value: "root123456"
image: minio/minio:latest
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -c
- minio server /data --console-address ":5000"
ports:
- name: data
containerPort: 9000
protocol: "TCP"
- name: console
containerPort: 5000
protocol: "TCP"
---
apiVersion: v1
kind: Service
metadata:
name: minio
spec:
type: NodePort #新增
ports:
- name: data
port: 9000
targetPort: 9000
nodePort: 30900 #新增
protocol: TCP
- name: console
port: 5000
targetPort: 5000
nodePort: 30500 #新增
protocol: TCP
selector:
app: minio
---
安装好后浏览器访问ui,登录密码admin和root123456
ip:30500
创建buckets,例如创建名字最少3位数,例如hhh,然后上传图片,支持在线预览,设置公有属性
所有人可以访问图片
ip:30900/hhh/图片名称
注意
1、是MINIO_ROOT_USER、 MINIO_ROOT_PASSWORD 还是MINIO_ACCESS_KEY、MINIO_SECRET_KEY 具体没研究过,可以去官网看,或者直接容器启动后,查看环境变量。MINIO_ROOT_PASSWORD不得少于8位
2、修改容器启动的第一命令/bin/sh -c minio server /data --console-address ":5000",使其固定Console端口5000
集群版安装 ,没试过
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_ROOT_USER
value: "admin"
- name: MINIO_ROOT_PASSWORD
value: "root123456"
image: minio/minio
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -c
- minio server --console-address ":5000" http://minio-{0...3}.minio.default.svc.cluster.local/data
ports:
- name: data
containerPort: 9000
protocol: "TCP"
- name: console
containerPort: 5000
protocol: "TCP"
volumeMounts:
- name: data
mountPath: /data
- name: date-config
mountPath: /etc/localtime
volumes:
- name: date-config
hostPath:
path: /usr/share/zoneinfo/Asia/Shanghai
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi
storageClassName: little
---
apiVersion: v1
kind: Service
metadata:
name: minio
labels:
app: minio
spec:
clusterIP: None
ports:
- port: 9000
name: data
- port: 5000
name: console
selector:
app: minio
---
apiVersion: v1
kind: Service
metadata:
name: minio-service
spec:
type: NodePort
ports:
- name: data
port: 9000
targetPort: 9000
protocol: TCP
nodePort:
- name: console
port: 5000
targetPort: 5000
protocol: TCP
nodePort:
selector:
app: minio
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: minio
namespace: default
spec:
rules:
- host: minio.od.com
http:
paths:
- path: /
backend:
serviceName: minio-service
servicePort: 5000
更多推荐
已为社区贡献13条内容
所有评论(0)