minio kubernetes快速搭建

  • pod.yaml
apiVersion: v1
kind: Pod
metadata:
  labels:
    app: minio
  name: minio
  namespace: minio-dev # Change this value to match the namespace metadata.name
spec:
  containers:
  - name: minio
    image: quay.io/minio/minio:latest
    command:
    - /bin/bash
    - -c
    args:
    - minio server /data --console-address :9001
    volumeMounts:
    - mountPath: /data
      name: localvolume # Corresponds to the `spec.volumes` Persistent Volume
    ports:
      - containerPort: 9001
        name: console
      - containerPort: 9000
        name: fs
  nodeSelector:
    kubernetes.io/hostname: node4.kubernetes.dev  # Specify a node label associated to the Worker Node on which you want to deploy the pod.
  volumes:
  - name: localvolume
    hostPath: # MinIO generally recommends using locally-attached volumes
      path: /opt/k8s/minio # Specify a path to a local drive or volume on the Kubernetes worker node
      type: DirectoryOrCreate # The path to the last directory must exist

使用Service讲外部流量路由到上面的Pod:

  • service.yaml
apiVersion: v1
kind: Service
metadata:
  name: minio
  namespace: minio-dev
spec:
  selector:
    app: minio
  type: NodePort
  ports:
    - protocol: TCP
      port: 9000
      targetPort: 9000
      name: fs
      nodePort: 29000
    - protocol: TCP
      port: 9001
      targetPort: 9001
      name: console
      nodePort: 29001

登录${kubernetes_node_ip}:29001访问minio界面。

参考:Quickstart for Kubernetes

posted @ 2023-01-09 14:44  Oneslide  阅读(116)  评论(0编辑  收藏  举报