本文主要是介绍k8s学习(三十)K8s部署MinIO集群,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
确认安装前已经安装好StorageClass,可参考:https://blog.csdn.net/u011943534/article/details/100887530
1、准备镜像
docker pull minio/minio:RELEASE.2021-05-27T22-06-31Z
docker save -o minio.tar docker.io/minio/minio:RELEASE.2021-05-27T22-06-31Z
拷贝至服务器
docker load -i minio.tar
docker tag docker.io/minio/minio:RELEASE.2021-05-27T22-06-31Z 172.16.10.190:80/library/minio:RELEASE.2021-05-27T22-06-31Z
docker push 172.16.10.190:80/library/minio:RELEASE.2021-05-27T22-06-31Z
2、生成yaml文件
minio.yaml
apiVersion: v1
kind: Service
metadata:name: miniolabels:app: minio
spec:clusterIP: Noneports:- port: 9000name: minioselector:app: minio
---
apiVersion: apps/v1
kind: StatefulSet
metadata:name: minio
spec:serviceName: minioreplicas: 4selector:matchLabels:app: miniotemplate:metadata:labels:app: miniospec:containers:- name: minioenv:- name: MINIO_ACCESS_KEYvalue: "admin"- name: MINIO_SECRET_KEYvalue: "iscas123"image: 172.16.10.190:80/library/minio:RELEASE.2021-05-27T22-06-31Zargs:- server- http://minio-{0...3}.minio.default.svc.cluster.local/dataports:- containerPort: 9000# These volume mounts are persistent. Each pod in the PetSet# gets a volume mounted based on this field.volumeMounts:- name: datamountPath: /data# These are converted to volume claims by the controller# and mounted at the paths mentioned above.volumeClaimTemplates:- metadata:name: dataannotations:volume.beta.kubernetes.io/storage-class: "course-nfs-storage"spec:accessModes:- ReadWriteOnceresources: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:
---
apiVersion: v1
kind: Service
metadata:name: minio-service
spec:type: NodePortports:- port: 9000targetPort: 9000nodePort: 30900protocol: TCPselector:app: minio
kubetl apply -f minio.yaml
3、访问
访问:http://http://172.16.10.160:30900
这篇关于k8s学习(三十)K8s部署MinIO集群的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!