在 Kubernetes 上安装

参考:

https://min.io/docs/minio/kubernetes/upstream/index.html

在服务器根目录下,创建 minio.yaml 文件,文件内容为:

---
kind: ConfigMap
apiVersion: v1
metadata:
  name: minio-cm
  annotations:
    kubesphere.io/creator: admin
data:
  minio.root.user: 'admin'
  minio.root.password: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'
---
apiVersion: v1
kind: Service
metadata:
  name: minio-svc
  namespace: dw-prod
  annotations:
    kubesphere.io/alias-name: MinIO 分布式存储
    kubesphere.io/description: MinIO 分布式存储
spec:
  ports:
    - name: tcp-9000
      port: 9000
      protocol: TCP
      targetPort: 9000
    - name: tcp-9001
      port: 9001
      protocol: TCP
      targetPort: 9001
  selector:
    app: minio
  type: NodePort
---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: minio-deploy
  namespace: dw-prod
  annotations:
    kubesphere.io/alias-name: MinIO 分布式存储
    kubesphere.io/description: MinIO 分布式存储
spec:
  replicas: 1
  selector:
    matchLabels:
      app: minio
  template:
    metadata:
      labels:
        app: minio
    spec:
      containers:
        - name: minio
          image: 'quay.io/minio/minio'
          args:
            - server
            - /data
            - '--console-address'
            - ':9000'
            - '--address'
            - ':9090'
          ports:
            - containerPort: 9000
              protocol: TCP
            - containerPort: 9001
              protocol: TCP
          env:
            - name: MINIO_ROOT_USER
              valueFrom:
                configMapKeyRef:
                  name: minio-cm
                  key: minio.root.user
            - name: MINIO_ROOT_PASSWORD
              valueFrom:
                configMapKeyRef:
                  name: minio-cm
                  key: minio.root.password
          imagePullPolicy: Always

使用 kubectl 执行如下命令部署 minio 服务 :

kubectl create -f minio.yaml --namespace=你的命名空间

kubectl create -f minio.yaml --namespace=dw-prod

挂载文件存储目录 /u01/minio/data ,指向本地的目录地址,

volumeMounts:

  • name: uploads
    mountPath: /u01/minio/data

作者:Jeebiz  创建时间:2023-02-17 10:27
最后编辑:Jeebiz  更新时间:2024-08-02 11:04