k8s中部署minio集群

vim minio.yml

apiVersion: v1
kind: Namespace
metadata:
  name: minio
---
apiVersion: v1
kind: Service
metadata:
  name: minio
  namespace: minio
  labels:
    name: minio
spec:
  type: NodePort
  ports:
  - port: 9000
    nodePort: 30090
    name: m90
  - port: 9001
    nodePort: 30091
    name: m91
  selector:
    name: minio
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: minio
  namespace: minio
spec:
  selector:
    matchLabels:
      name: minio
  replicas: 2
  template:
    metadata:
      labels:
        name: minio
    spec:
      containers:
      - name: minio
        env:
        - name: MINIO_ROOT_USER
          value: admin
        - name: MINIO_ROOT_PASSWORD
          value: admin@20220331
        image: docker.io/minio/minio
        imagePullPolicy: Never
        args:
        - server
        - /data0
        - /data1 
        - /data2
        - /data3
        - --console-address
        - ":9001"
        ports:
        - containerPort: 9000
        - containerPort: 9001
        volumeMounts:
        - name: data0
          mountPath: /data0
        - name: data1
          mountPath: /data1
        - name: data2
          mountPath: /data2
        - name: data3
          mountPath: /data3         
      volumes:
      - name: data0
        persistentVolumeClaim:
          claimName: minio-data0
      - name: data1
        persistentVolumeClaim:
          claimName: minio-data1
      - name: data2
        persistentVolumeClaim:
          claimName: minio-data2
      - name: data3
        persistentVolumeClaim:
          claimName: minio-data3

vim minio-pv-nfs.yml

apiVersion: v1
kind: PersistentVolume
metadata:
  name: nfs-data-d0
spec:
  storageClassName: minio-data-00
  mountOptions:
  - nolock
  capacity: 
    storage: 5Gi
  accessModes:
  - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  nfs:
    path: /data/nfs/d0
    server: 172.17.111.36
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: nfs-data-d1
spec:
  storageClassName: minio-data-01
  mountOptions:
  - nolock
  capacity: 
    storage: 5Gi
  accessModes:
  - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  nfs:
    path: /data/nfs/d1
    server: 172.17.111.36
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: nfs-data-d2
spec:
  storageClassName: minio-data-02
  mountOptions:
  - nolock
  capacity: 
    storage: 5Gi
  accessModes:
  - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  nfs:
    path: /data/nfs/d2
    server: 172.17.111.36
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: nfs-data-d3
spec:
  storageClassName: minio-data-03
  mountOptions:
  - nolock
  capacity: 
    storage: 5Gi
  accessModes:
  - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  nfs:
    path: /data/nfs/d3
    server: 172.17.111.36

vim vim minio-pvc.yml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: minio-data0
  namespace: minio
spec:
  storageClassName: minio-data-00
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 5Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: minio-data1
  namespace: minio
spec:
  storageClassName: minio-data-01
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 5Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: minio-data2
  namespace: minio
spec:
  storageClassName: minio-data-02
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 5Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: minio-data3
  namespace: minio
spec:
  storageClassName: minio-data-03
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 5Gi

部署

kubectl apply -f minio.yml

查看

kubectl get deployment,replicaset,service,pod,pvc  -n minio

NAME                    READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/minio   2/2     2            2           18m

NAME                              DESIRED   CURRENT   READY   AGE
replicaset.apps/minio-767c49587   2         2         2       18m

NAME            TYPE       CLUSTER-IP       EXTERNAL-IP   PORT(S)                         AGE
service/minio   NodePort   10.109.198.244           9000:30090/TCP,9001:30091/TCP   18m

NAME                        READY   STATUS    RESTARTS   AGE
pod/minio-767c49587-c67br   1/1     Running   0          18m
pod/minio-767c49587-ww6r5   1/1     Running   0          18m

NAME                                STATUS   VOLUME        CAPACITY   ACCESS MODES   STORAGECLASS   AGE
persistentvolumeclaim/minio-data0   Bound    nfs-data-d0   5Gi        RWX                           18m
persistentvolumeclaim/minio-data1   Bound    nfs-data-d1   5Gi        RWX                           18m
persistentvolumeclaim/minio-data2   Bound    nfs-data-d3   5Gi        RWX                           18m
persistentvolumeclaim/minio-data3   Bound    nfs-data-d2   5Gi        RWX                           18m

访问控制台

http://IP:Nodeport

你可能感兴趣的:(kubernetes,kubernetes,minio/minio)