1.直接部署一个pod
需要挂载存储款, 可参考 之前文章设置 https://blog.csdn.net/weimeibuqieryu/article/details/140183843
2.部署yaml
创建部署文件 minio-deploy.yaml
apiVersion: v1
kind: PersistentVolume
metadata:name: minio-pvnamespace: ruoyi #使用ns ruoyi
spec:capacity:storage: 10Gi #存储容量为 10 GiBaccessModes:- ReadWriteManypersistentVolumeReclaimPolicy: Retain # 删除 PVC 后 PV 保留nfs:path: /nfs/minio #使用 NFS 服务器的路径和地址, 使用自己定义的server: 139.159.140.xxx
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:name: minio-pvcnamespace: ruoyi
spec:accessModes:- ReadWriteManyresources:requests:storage: 10Gi
---
apiVersion: v1
kind: Secret
metadata:name: minio-secretnamespace: ruoyi
type: Opaque
stringData:root-user: minioroot-password: password #明文密码, 记得改为自己的
---
apiVersion: apps/v1
kind: Deployment
metadata:name: minionamespace: ruoyi
spec:selector:matchLabels:app: miniostrategy:type: Recreatetemplate:metadata:labels:app: miniospec:nodeSelector:node-role.kubernetes.io/master: "" # 指定 Pod 运行在 master 节点containers:- name: minioimage: minio/minio:latestargs:- server- /data- --console-address- ":9001"ports:- containerPort: 9000- containerPort: 9001env:- name: MINIO_ROOT_USERvalueFrom:secretKeyRef:name: minio-secretkey: root-user- name: MINIO_ROOT_PASSWORDvalueFrom:secretKeyRef:name: minio-secretkey: root-passwordvolumeMounts:- name: storagemountPath: "/data"volumes:- name: storagepersistentVolumeClaim:claimName: minio-pvc
---
apiVersion: v1
kind: Service
metadata:name: minio-servicenamespace: ruoyi
spec:type: NodePort # 暴露服务为 NodePort 类型ports:- name: apiport: 9000targetPort: 9000nodePort: 30900- name: consoleport: 9001targetPort: 9001nodePort: 30901 # 节点端口 30901, 可外部访问selector:app: minio
部署该服务
kubectl apply -f minio-deploy.yaml
就可以使用节点的ip+30901来访问了. 公网记得防火墙的端口要打开
3.ruoyi-vue-plus项目配置minio
设置如下即可