K3s 集群 helm 化改造之集群 minio

背景概况

MinIO 是全球领先的对象存储先锋,以 Apache License v2.0 发布的对象存储服务器,是为云应用和虚拟机而设计的分布式对象存储服务器。在标准硬件上,读/写速度上高达183GB/s和171GB/s。它与 Amazon S3 云存储服务兼容。 它最适用于存储非结构化数据,如照片、视频、日志文件、备份和容器/虚拟机映像。 对象的大小可以从几KB 到最大5TB。

对象存储,兼容Amazon S3协议
安装运维相对简单,开箱即用
后端除了本地文件系统,还支持多种存储系统,目前已经包括 OSS
原生支持bucket事件通知机制
可通过多节点集群方式,支持一定的高可用和数据容灾
有WEB管理界面和CLI,可以用于测试或者管理
公开bucket中的数据可以直接通过HTTP获取

image

集群模式要求: 集群可以调度资源节点 >=4
集群资源不足时部署参考: https://www.cnblogs.com/vpc123/articles/14346984.html

Minio 资源

# 项目工作展示目录
cd /home/work/minio-demo/
  • minio-statefulset.yaml
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: "admin123"
        - name: MINIO_SECRET_KEY
          value: "admin123"
        image: minio/minio
        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
    spec:
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 10Gi
      # Uncomment and add storageClass specific to your requirements below. Read more https://kubernetes.io/docs/concepts/storage/persistent-volumes/#class-1
      #storageClassName:
  • minio-svc.yaml
apiVersion: v1
kind: Service
metadata:
  name: minio
  labels:
    app: minio
spec:
  clusterIP: None
  ports:
    - port: 9000
      name: minio
  selector:
    app: minio
  • minio-ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: traefik-minio
  namespace: default
  annotations:
    kubernetes.io/ingress.class: traefik
spec:
  rules:
  - host: traefik.minio-minio-distributed.io
    http:
      paths:
      - backend:
          serviceName: minio
          servicePort: 9000
  • minio-nodeport.yaml
apiVersion: v1
kind: Service
metadata:
  name: minio-service
spec:
  type: NodePort
  ports:
    - port: 9000
      targetPort: 9000
      protocol: TCP
  selector:
    app: minio

资源创建过程:

# 创建StatefulSet
kubectl apply -f  minio-statefulset.yaml

# 创建service
kubectl apply -f minio-svc.yaml

# 创建ingress
kubectl apply -f minio-ingress.yaml

# 创建nodeport
kubectl apply -f minio-nodeport.yaml

Helm 改造

资源改造目录如下:

[root@vm3290 helm]# tree minio-distributed/
minio-distributed/
├── Chart.yaml
├── README.md
├── templates
│   ├── minio-ingress.yaml
│   ├── minio-nodeport.yaml
│   ├── minio-statefulset.yaml
│   ├── minio-svc.yaml
│   ├── NOTES.txt
│   └── tests
│       └── test-connection.yaml
└── values.yaml

2 directories, 9 files

定义 values.yaml 内容如下:

replicas: 4
strategy: Recreate
resources:
  limits:
    cpu: "1"
    memory: 1Gi
  requests:
    cpu: 200m
    memory: 200Mi

pv:
  accessModes: ReadWriteOnce
  storage: 5Gi

service:
  name: minio-service
  nodeport: minio-node

ingress:
  name: minio-ingress
  host: traefik.minio-distributed.io

# 请不要轻易修改此配置
global:
  namespace: minio-ss
  minio:
    name: minio-ss
    image: minio/minio
    tag: latest
    port: 9000

项目部署

1. 安装
helm install  -n  minio-distributed minio-distributed 

2. 更新
helm upgrade  -n  minio-distributed minio-distributed 

3. 卸载
helm delete -n  minio-distributed 

配置 hosts 文件:


image

浏览器打开访问:


image

你可能感兴趣的:(K3s 集群 helm 化改造之集群 minio)