Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lamhoangtung/99dd40da4ae1427edb89d35330a83d3d to your computer and use it in GitHub Desktop.
Save lamhoangtung/99dd40da4ae1427edb89d35330a83d3d to your computer and use it in GitHub Desktop.
Running minio in minikube

Minio FS mode:

  1. Deploy minio in fs mode with below yaml in a file like $ kubectl create -f my-minio-fs.yaml
## Create persistent volume claim for minio to store data.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-minio-fs-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi
---
## Run minio fs deployment.
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-minio-fs
  labels:
    app: my-minio-fs
spec:
  selector:
    matchLabels:
      app: my-minio-fs
  template:
    metadata:
      labels:
        app: my-minio-fs
    spec:
      volumes:
      - name: data
        persistentVolumeClaim:
          claimName: my-minio-fs-pvc
      containers:
      - name: my-minio-fs
        volumeMounts:
        - name: data 
          mountPath: "/data"
        image: minio/minio:RELEASE.2017-11-22T19-55-46Z
        args:
        - server
        - /data
        env:
        - name: MINIO_ACCESS_KEY
          value: "minio_access_key"
        - name: MINIO_SECRET_KEY
          value: "minio_secret_key"
        ports:
        - containerPort: 9000
          hostPort: 9000
  1. To make the above deployment accessible from outside network, run below command
$ kubectl expose deployment/my-minio-fs --type="NodePort" --port 9000
  1. Run below command to know the port the above service exposed.
kubectl get services/my-minio-fs -o go-template='{{(index .spec.ports 0).nodePort}}'
  1. Use this port in the endpoint http://minikube:<EXPOSED-PORT>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment