minio.yaml


Overview

The minio.yaml file is a Kubernetes manifest template designed for deploying a MinIO object storage service within a Kubernetes cluster using Helm templating. It defines the necessary Kubernetes resources to provision persistent storage, deploy a MinIO StatefulSet, and expose MinIO through a Service.

The main purpose of this file is to manage MinIO deployment in a reproducible, configurable, and scalable manner, integrating persistent storage (via PersistentVolumeClaim), ensuring stable network identity and storage (via StatefulSet), and enabling access to MinIO's S3-compatible API and web console (via Service).


Detailed Explanation of Components

1. PersistentVolumeClaim (PVC)

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: {{ include "ragflow.fullname" . }}-minio
  annotations:
    "helm.sh/resource-policy": keep
  labels:
    {{- include "ragflow.labels" . | nindent 4 }}
    app.kubernetes.io/component: minio
spec:
  {{- with .Values.minio.storage.className }}
  storageClassName: {{ . }}
  {{- end }}
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: {{ .Values.minio.storage.capacity }}

Purpose

Key Fields

Helm Template Variables

Usage Example

In values.yaml:

minio:
  storage:
    capacity: 10Gi
    className: standard

2. StatefulSet

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: {{ include "ragflow.fullname" . }}-minio
  labels:
    {{- include "ragflow.labels" . | nindent 4 }}
    app.kubernetes.io/component: minio
  annotations:
    checksum/config: {{ include (print $.Template.BasePath "/env.yaml") . | sha256sum }}
spec:
  replicas: 1
  selector:
    matchLabels:
      {{- include "ragflow.selectorLabels" . | nindent 6 }}
      app.kubernetes.io/component: minio
  {{- with .Values.minio.deployment.strategy }}
  strategy:
    {{- . | toYaml | nindent 4 }}
  {{- end }}
  template:
    metadata:
      labels:
        {{- include "ragflow.labels" . | nindent 8 }}
        app.kubernetes.io/component: minio
    spec:
      {{- if or .Values.imagePullSecrets .Values.minio.image.pullSecrets }}
      imagePullSecrets:
        {{- with .Values.imagePullSecrets }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
        {{- with .Values.minio.image.pullSecrets }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
      {{- end }}
      containers:
      - name: minio
        image: {{ .Values.minio.image.repository }}:{{ .Values.minio.image.tag }}
        {{- with .Values.minio.image.pullPolicy }}
        imagePullPolicy: {{ . }}
        {{- end }}
        envFrom:
          - secretRef:
              name: {{ include "ragflow.fullname" . }}-env-config
        args:
          - server
          - "--console-address=:9001"
          - "/data"
        ports:
          - containerPort: 9000
            name: s3
          - containerPort: 9001
            name: console
        {{- with .Values.minio.deployment.resources }}
        resources:
          {{- . | toYaml | nindent 10 }}
        {{- end }}
        volumeMounts:
          - mountPath: /data
            name: minio-data
      volumes:
        - name: minio-data
          persistentVolumeClaim:
            claimName: {{ include "ragflow.fullname" . }}-minio

Purpose

Key Fields Explained

Helm Template Variables

Usage Example

In values.yaml:

minio:
  image:
    repository: minio/minio
    tag: RELEASE.2023-06-15T10-00-00Z
    pullPolicy: IfNotPresent
  deployment:
    strategy:
      type: RollingUpdate
    resources:
      limits:
        cpu: 500m
        memory: 512Mi
      requests:
        cpu: 250m
        memory: 256Mi

3. Service

apiVersion: v1
kind: Service
metadata:
  name: {{ include "ragflow.fullname" . }}-minio
  labels:
    {{- include "ragflow.labels" . | nindent 4 }}
    app.kubernetes.io/component: minio
spec:
  selector:
    {{- include "ragflow.selectorLabels" . | nindent 4 }}
    app.kubernetes.io/component: minio
  ports:
    - name: s3
      protocol: TCP
      port: 9000
      targetPort: s3
    - name: console
      protocol: TCP
      port: 9001
      targetPort: console
  type: {{ .Values.minio.service.type }}

Purpose

Key Fields Explained

Usage Example

In values.yaml:

minio:
  service:
    type: ClusterIP

Important Implementation Details


Interaction with Other Parts of the System


Visual Diagram

The following flowchart illustrates the relationships and interactions between the main Kubernetes resources defined in minio.yaml:

flowchart TD
    PVC[PersistentVolumeClaim]
    StatefulSet[MinIO StatefulSet]
    Service[MinIO Service]

    PVC -->|Mounts volume| StatefulSet
    StatefulSet -->|Pods expose ports 9000 (S3) and 9001 (Console)| Service
    Service -->|Routes traffic| StatefulSet

    classDef k8sResource fill:#f9f,stroke:#333,stroke-width:1px,color:#000;
    class PVC,StatefulSet,Service k8sResource;

Summary

The minio.yaml file is a Helm-templated Kubernetes manifest that provisions a MinIO object storage deployment with persistent storage, controlled pod lifecycle, and network exposure. It is a critical part of managing scalable, durable, and accessible object storage in a Kubernetes environment, facilitating integration with cloud-native workflows and other components in the Ragflow system.


Usage Notes


If you need further integration details or examples of Helm configuration for this deployment, please let me know!