k8s 中部署minio

2 篇文章 0 订阅
  1. 创建namespace
apiVersion: v1
kind: Namespace
metadata:
  name: "minio"
  labels:
    name: "minio"
  1. 创建PV pvc
kind: PersistentVolume
apiVersion: v1
metadata:
  name: minio-pv
  namespace: minio
  labels:
    app: minio-storage-claim
spec:
  storageClassName: manual
  capacity:
    storage: 5Gi
  accessModes:
    - ReadWriteMany
  hostPath:
    path: "/home/ellis/k8s/minio/storage"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: minio-pvc-claim
  namespace: minio
  labels:
    app: minio-storage-claim
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 5Gi
  1. 部署deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  # This name uniquely identifies the Deployment
  name: minio
  namespace: minio
spec:
  selector:
    matchLabels:
      app: minio # has to match .spec.template.metadata.labels
  strategy:
    # Specifies the strategy used to replace old Pods by new ones
    # Refer: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy
    type: Recreate
  template:
    metadata:
      labels:
        # This label is used as a selector in Service definition
        app: minio
    spec:
      # Volumes used by this deployment
      volumes:
      - name: data
        # This volume is based on PVC
        persistentVolumeClaim:
          # Name of the PVC created earlier
          claimName: minio-pvc-claim
      containers:
      - name: minio
        # Volume mounts for this container
        volumeMounts:
        # Volume 'data' is mounted to path '/data'
        - name: data 
          mountPath: /data
        # Pulls the latest Minio image from Docker Hub
        image: minio/minio
        args:
        - server
        - --console-address
        - :9001
        - /data
        env:
        # MinIO access key and secret key
        - name: MINIO_ROOT_USER
          value: "minio"
        - name: MINIO_ROOT_PASSWORD
          value: "minio123"
        - name: MINIO_SERVER_URL
          value: "http://192.168.214.133:30009"
        ports:
        - containerPort: 9000
        - containerPort: 9001
        # Readiness probe detects situations when MinIO server instance
        # is not ready to accept traffic. Kubernetes doesn't forward
        # traffic to the pod while readiness checks fail.
        readinessProbe:
          httpGet:
            path: /minio/health/ready
            port: 9000
          initialDelaySeconds: 120
          periodSeconds: 20
        # Liveness probe detects situations where MinIO server instance
        # is not working properly and needs restart. Kubernetes automatically
        # restarts the pods if liveness checks fail.
        livenessProbe:
          httpGet:
            path: /minio/health/live
            port: 9000
          initialDelaySeconds: 120
          periodSeconds: 20

注意

  • 添加 - --console-address - :9001这两个参数,是将console界面暴露到9001端口,后续通过service 暴露出去
  • 添加 MINIO_SERVER_URL参数,其中ip是主机host,端口是9000映射出去的service的端口
  1. service
apiVersion: v1
kind: Service
metadata:
  name: minio-service
  namespace: minio
spec:
  type: NodePort
  ports:
    - name: server-port
      port: 9000
      targetPort: 9000
      protocol: TCP
      nodePort: 30009
    - name: console-port
      port: 9001
      targetPort: 9001
      protocol: TCP
      nodePort: 30010
  selector:
    app: minio

https://computingforgeeks.com/deploy-and-manage-minio-storage-on-kubernetes/

https://github.com/kubernetes/examples/blob/master/staging/storage/minio/README.md#step-1-create-persistent-volume-claim

https://stackoverflow.com/questions/70785172/k8s-deployment-minio-how-to-access-the-console

https://github.com/minio/console/issues/1632

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值