【云原生】Minio on k8s 讲解与实战操作

云计算 云原生
MinIO 是在 GNU Affero 通用公共许可证 v3.0 下发布的高性能对象存储。它与 Amazon S3 云存储服务 API 兼容。使用 MinIO 为机器学习、分析和应用程序数据工作负载构建高性能基础架构。

一、概述

MinIO 是在 GNU Affero 通用公共许可证 v3.0 下发布的高性能对象存储。它与 Amazon S3 云存储服务 API 兼容。使用 MinIO 为机器学习、分析和应用程序数据工作负载构建高性能基础架构。

官方文档:https://docs.min.io/中文文档:http://docs.minio.org.cn/docs/GitHub地址:https://github.com/minio/minio/

图片

二、开始编排部署

因为minio是有chart包,所以这里就基于现有的chart包进行改造。

1)下载chart 包

helm repo add bitnami https://charts.bitnami.com/bitnami
helm pull bitnami/minio --version 11.10.16
tar -xf minio-11.10.16.tgz

2)构建镜像

这里就不重新构建镜像了,只是把远程的包推送到本地harbor仓库,如有不知道怎么构建镜像的小伙伴,欢迎留言或私信。

docker pull docker.io/bitnami/minio:2022.11.11-debian-11-r0
docker tag docker.io/bitnami/minio:2022.11.11-debian-11-r0 myharbor.com/bigdata/minio:2022.11.11-debian-11-r0
docker push myharbor.com/bigdata/minio:2022.11.11-debian-11-r0

docker pull docker.io/bitnami/minio-client:2022.11.7-debian-11-r0
docker tag docker.io/bitnami/minio-client:2022.11.7-debian-11-r0 myharbor.com/bigdata/minio-client:2022.11.7-debian-11-r0
docker push myharbor.com/bigdata/minio-client:2022.11.7-debian-11-r0

3)修改yaml编排

  • minio/values.yaml
image:
registry: myharbor.com
repository: bigdata/minio
tag: 2022.11.11-debian-11-r0

clientImage:
registry: myharbor.com
repository: bigdata/minio-client
tag: 2022.11.7-debian-11-r0

# `standalone` or `distributed`
mode: distributed

# 登录账号,密码
auth:
rootUser: admin
rootPassword: "admin12345"

statefulset:
## @param statefulset.replicaCount Number of pods per zone (only for MinIO® distributed mode). Should be even and `>= 4`
##
replicaCount: 4

service:
## @param service.type MinIO® service type
##
type: NodePort
nodePorts:
api: "31900"
console: "31901"

persistence:
enabled: true
storageClass: "local-minio-stroage"
size: 10Gi
local:
- name: minio-0
host: "local-168-182-110"
path: "/opt/bigdata/servers/minio/data/data1"
- name: minio-1
host: "local-168-182-111"
path: "/opt/bigdata/servers/minio/data/data1"
- name: minio-2
host: "local-168-182-112"
path: "/opt/bigdata/servers/minio/data/data1"
- name: minio-3
host: "local-168-182-110"
path: "/opt/bigdata/servers/minio/data/data2"
  • minio/templates/pv.yaml
{{- range .Values.persistence.local }}
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: {{ .name }}
labels:
name: {{ .name }}
spec:
storageClassName: {{ $.Values.persistence.storageClass }}
capacity:
storage: {{ $.Values.persistence.size }}
accessModes:
- ReadWriteOnce
local:
path: {{ .path }}
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- {{ .host }}
---
{{- end }}

4)开始部署

ssh local-168-182-110 mkdir -p /opt/bigdata/servers/minio/data/data{1..2}
ssh local-168-182-111 mkdir -p /opt/bigdata/servers/minio/data/data{1..2}
ssh local-168-182-112 mkdir -p /opt/bigdata/servers/minio/data/data{1..2}

# --dry-run 模拟安装
# --debug 开启debug
# helm install --dry-run --debug minio ./minio -n minio --create-namespace

helm install --debug minio ./minio -n minio --create-namespace

NOTES

CHART NAME: minio
CHART VERSION: 11.10.16
APP VERSION: 2022.11.11

** Please be patient while the chart is being deployed **

MinIO® can be accessed via port on the following DNS name from within your cluster:

minio.minio.svc.cluster.local

To get your credentials run:

export ROOT_USER=$(kubectl get secret --namespace minio minio -o jsnotallow="{.data.root-user}" | base64 -d)
export ROOT_PASSWORD=$(kubectl get secret --namespace minio minio -o jsnotallow="{.data.root-password}" | base64 -d)

To connect to your MinIO® server using a client:

- Run a MinIO® Client pod and append the desired command (e.g. 'admin info'):

kubectl run --namespace minio minio-client \
--rm --tty -i --restart='Never' \
--env MINIO_SERVER_ROOT_USER=$ROOT_USER \
--env MINIO_SERVER_ROOT_PASSWORD=$ROOT_PASSWORD \
--env MINIO_SERVER_HOST=minio \
--image myharbor.com/bigdata/minio-client:2022.11.7-debian-11-r0 -- admin info minio

To access the MinIO® web UI:

- Get the MinIO® URL:

export NODE_PORT=$(kubectl get --namespace minio -o jsnotallow="{.spec.ports[0].nodePort}" services minio)
export NODE_IP=$(kubectl get nodes --namespace minio -o jsnotallow="{.items[0].status.addresses[0].address}")
echo "MinIO® web URL: http://$NODE_IP:$NODE_PORT/minio"

图片

查看

kubectl get pods,svc -n minio -owide

图片

5)测试验证

web登录:添加链接描述http://local-168-182-110:31901/账号/密码:admin/admin12345

图片

图片

创建桶并上传文件

图片

mc客户端

# 查看notes
helm get notes minio -n minio

# 启动客户端
export ROOT_USER=$(kubectl get secret --namespace minio minio -o jsnotallow="{.data.root-user}" | base64 -d)
export ROOT_PASSWORD=$(kubectl get secret --namespace minio minio -o jsnotallow="{.data.root-password}" | base64 -d)

kubectl run --namespace minio minio-client \
--rm --tty -i --restart='Never' \
--env MINIO_SERVER_ROOT_USER=$ROOT_USER \
--env MINIO_SERVER_ROOT_PASSWORD=$ROOT_PASSWORD \
--env MINIO_SERVER_HOST=minio \
--image myharbor.com/bigdata/minio-client:2022.11.7-debian-11-r0 -- admin info minio

图片

6)卸载

helm uninstall minio -n minio

ssh local-168-182-110 rm -fr /opt/bigdata/servers/minio/data/data{1..2}/*
ssh local-168-182-111 rm -fr /opt/bigdata/servers/minio/data/data{1..2}/*
ssh local-168-182-112 rm -fr /opt/bigdata/servers/minio/data/data{1..2}/*

git 地址:https://gitee.com/hadoop-bigdata/minio-on-k8s

责任编辑:武晓燕 来源: 大数据与云原生技术分享
相关推荐

2022-11-08 08:55:31

2023-03-07 07:56:37

Sqoopk8s底层

2022-10-14 07:42:50

LuceneHTTPWeb

2023-03-03 07:54:21

2023-03-01 07:42:12

HBase编排部署数据

2022-11-06 21:31:11

云原生Sentinel集群模式

2022-10-10 12:54:00

Flink运维

2023-02-27 07:40:00

2023-09-11 00:09:18

2022-12-13 09:01:50

云原生组件数据

2022-11-28 17:22:32

高可用master节点

2022-12-26 08:14:57

K8sCronhpa定时弹性

2021-04-25 10:26:58

云计算云原生

2023-11-06 01:17:25

主机容器选项

2023-08-29 10:27:32

2024-09-26 09:50:07

2024-06-12 13:21:06

2022-04-07 10:17:18

云原生服务器优化

2023-09-06 08:12:04

k8s云原生

2023-03-27 07:43:35

点赞
收藏

51CTO技术栈公众号