Deploy MinIO on k8s

  Uncategorized
kind: PersistentVolume
apiVersion: v1
metadata:
    name: minio
spec:
    capacity:
        storage: 100G
    volumeMode: Filesystem
    accessModes:
        - ReadWriteMany
    persistentVolumeReclaimPolicy: Retain
    storageClassName: efs
    csi:
        driver: efs.csi.aws.com
        volumeHandle: fs-01190056cfdde3cce:/minio
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
    name: minio
spec:
    accessModes:
        - ReadWriteMany
    storageClassName: efs
    resources:
        requests:
            storage: 100G
---
apiVersion: v1
kind: Pod
metadata:
    labels:
        app: minio
    name: minio
spec:
    containers:
        -   name: minio
            image: quay.io/minio/minio
            ports:
                -   containerPort: 9001
                -   containerPort: 9000
            command:
                - /bin/bash
                - -c
            args:
                - minio server /data --console-address :9001
            volumeMounts:
                -   mountPath: /data
                    name: minio
            env:
                -   name: MINIO_BROWSER_LOGIN_ANIMATION
                    value: "off"
                -   name: MINIO_ROOT_USER
                    value: admin
                -   name: MINIO_ROOT_PASSWORD
                    value: 29101996!Za
    volumes:
        -   name: minio
            persistentVolumeClaim:
                claimName: minio
---
apiVersion: v1
kind: Service
metadata:
    name: minio
spec:
    type: ClusterIP
    selector:
        app: minio
    ports:
        -   protocol: TCP
            port: 9001
            targetPort: 9001
            name: minioconsole
        -   protocol: TCP
            port: 9000
            targetPort: 9000
            name: minios3
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
    name: minios3
    annotations:
        kubernetes.io/ingress.class: nginx
        nginx.ingress.kubernetes.io/proxy-body-size: 102400m
        nginx.org/server-snippets: |
            ignore_invalid_headers off;
            client_max_body_size 0;
            proxy_buffering off;
            proxy_request_buffering off;
            
            location / {
                proxy_set_header Host $http_host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                
                proxy_connect_timeout 300;
                proxy_http_version 1.1;
                proxy_set_header Connection "";
                chunked_transfer_encoding off;
                proxy_pass http://minio:9000;
            }
spec:
    rules:
        -   host: s3.dotb.cloud
            http:
                paths:
                    -   path: /
                        pathType: Prefix
                        backend:
                            service:
                                name: minio
                                port:
                                    number: 9000
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
    name: minioconsole
    annotations:
        kubernetes.io/ingress.class: nginx
        nginx.ingress.kubernetes.io/proxy-body-size: 102400m
        nginx.org/server-snippets: |
            ignore_invalid_headers off;
            client_max_body_size 0;
            proxy_buffering off;
            proxy_request_buffering off;
            
            location / {
                proxy_set_header Host $http_host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-NginX-Proxy true;
        
                real_ip_header X-Real-IP;
                
                proxy_connect_timeout 300;
        
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                
                chunked_transfer_encoding off;
                proxy_pass http://minio:9001;
            }
spec:
    rules:
        -   host: files.dotb.cloud
            http:
                paths:
                    -   path: /
                        pathType: Prefix
                        backend:
                            service:
                                name: minio
                                port:
                                    number: 9001