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: 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
  selector:
    matchLabels:
      app: minio
  template:
    metadata:
      labels:
        app: minio
    spec:
      containers:
      - name: minio
        env:
        - name: MINIO_ACCESS_KEY
          value: "admin"
        - name: MINIO_SECRET_KEY
          value: "iscas123"
        image: 172.16.10.190:80/library/minio:RELEASE.2021-05-27T22-06-31Z
        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
      annotations:
        volume.beta.kubernetes.io/storage-class: "course-nfs-storage"
    spec:
      accessModes:
        - ReadWriteOnce
      resources:
        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: NodePort
  ports:
    - port: 9000
      targetPort: 9000
      nodePort: 30900
      protocol: TCP
  selector:
    app: minio


kubetl apply -f minio.yaml

3、访问
访问:http://http://172.16.10.160:30900
k8s学习(三十)K8s部署MinIO集群_第1张图片

你可能感兴趣的:(k8s,minio,MinIO,k8s部署Minio,Minio,部署Minio)