MinIO问题总结(持续更新)

发布于:2025-03-15 ⋅ 阅读:(21) ⋅ 点赞:(0)

Q: 之前使用正常,突然使用空间为0B,上传文件也是0B(部署在k8s中)

在这里插入图片描述
A:
1、检查pod状态

kubectl get pods

2、如果状态正常,则查看日志

kubectl logs <minio-pod-name>

提示: disk quota exceeded 表示存储卷可能已经达到了其分配的存储限制,无法再写入新的数据
3、解决:
增加存储容量、检查和清理旧数据、优化数据存储策略
4、优化:
设置磁盘使用率的监控和告警,以便在接近存储上限之前收到通知,及时采取行动。

扩容:

kubectl edit pvc <pvc-name> //编辑想要扩展的PVC,找到spec下的resources.requests.storage字段,并将其值更新为新容量大小
kubectl get pvc <pvc-name> //检查PVC的状态,确保其已经成功扩展

Q: 无法上传大文件

A: 配置允许客户端上传的最大请求体大小

---
# Ingress
apiVersion: networking.k8s.io/v1
kind: Ingress 
metadata:
  ...
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: 2048m

参考yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: minio-configmap
  namespace: company-product
data:
  MINIO_ROOT_USER: 'admin'
  MINIO_ROOT_PASSWORD: 'admin@localhost'

---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: minio
  namespace: company-product
spec:
  replicas: 1
  selector:
    matchLabels:
      app: minio
  serviceName: minio-service
  template:
    metadata:
      labels:
        app: minio
    spec:
      hostname: minio-0
      containers:
      - args:
        - server
        - /data
        - --console-address
        - :9090
        name: minio
        image: minio/minio:RELEASE.2021-10-27T16-29-42Z
        imagePullPolicy: IfNotPresent
        ports:
        - name: minio-api
          containerPort: 9000
          protocol: TCP
        - name: minio-ui
          containerPort: 9090
          protocol: TCP
        envFrom:
        - configMapRef:
            name: minio-configmap
        volumeMounts:
        - name: minio-data
          mountPath: /data
      imagePullSecrets:
        - name: harbor
      volumes:
      - name: minio-data
        persistentVolumeClaim:
          claimName: minio-pvc-5g

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: minio-pvc-5g
  namespace: company-product
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
  storageClassName: alibabacloud-cnfs-nas  # 根据你的存储类进行调整

---
apiVersion: v1
kind: Service
metadata:
  name: minio-service
  namespace: company-product
spec:
  ports:
    - name: minio-api
      port: 9000
      targetPort: 9000
      protocol: TCP
    - name: minio-ui
      port: 9090
      targetPort: 9090
      protocol: TCP
  selector:
    app: minio  # 与 StatefulSet 的 label 匹配
  type: ClusterIP


# 根据部署形式来选择是否需要以下配置
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: minio-ingress
  namespace: company-product
spec:
  rules:
  - host: minio.cn.company.com # 与实际的 域名匹配
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: minio-service  # 与实际的 Service 名称匹配
            port:
              number: 9000  # 与实际的 Service 端口匹配
  tls:
    - hosts:
        - minio.cn.company.com # 与实际的 域名匹配 
      secretName: cn-company-com-tls  # 与实际的 secret 匹配