Prerequisites:
- Run
minikube
withkvm
driver by$ minikube start --vm-driver kvm
Minio FS mode:
- 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: 1Gi
---
## Run minio fs deployment.
apiVersion: extensions/v1
kind: Deployment
metadata:
name: my-minio-fs
spec:
strategy:
type: Recreate
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"
- name: MINIO_SECRET_KEY
value: "minio123"
ports:
- containerPort: 9000
hostPort: 9000
- To make the above deployment accessible from outside network, run below command
$ kubectl expose deployment/my-minio-fs --type="NodePort" --port 9000
- 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}}'
- Use this port in the endpoint
http://minikube:<EXPOSED-PORT>
Minio Dist-XL mode:
- Deploy minio in dist-xl mode with below yaml in a file like
$ kubectl create -f my-minio-dist-xl.yaml
## Create headless service to StatefulSet to work.
apiVersion: v1
kind: Service
metadata:
name: my-minio-dist-xl-headless
labels:
app: my-minio-dist-xl-headless
spec:
ports:
- port: 9000
name: my-minio-dist-xl
clusterIP: None
selector:
app: my-minio-dist-xl-headless
---
apiVersion: apps/v1beta2
kind: StatefulSet
metadata:
name: my-minio-dist-xl
spec:
serviceName: "my-minio-dist-xl-headless"
replicas: 4
selector:
matchLabels:
app: my-minio-dist-xl-app
template:
metadata:
labels:
app: my-minio-dist-xl-app
spec:
containers:
- name: my-minio-dist-xl
env:
- name: MINIO_ACCESS_KEY
value: "minio"
- name: MINIO_SECRET_KEY
value: "minio123"
image: minio/minio:RELEASE.2017-11-22T19-55-46Z
args:
- server
- http://my-minio-dist-xl-0.my-minio-dist-xl-headless.default.svc.cluster.local/data
- http://my-minio-dist-xl-1.my-minio-dist-xl-headless.default.svc.cluster.local/data
- http://my-minio-dist-xl-2.my-minio-dist-xl-headless.default.svc.cluster.local/data
- http://my-minio-dist-xl-3.my-minio-dist-xl-headless.default.svc.cluster.local/data
ports:
- containerPort: 9000
name: my-minio-dist-xl
volumeMounts:
- name: data
mountPath: /data
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi
- To make the above deployment accessible from outside network, run below yaml
kubectl create -f my-minio-dist-xl-service.yaml
apiVersion: v1
kind: Service
metadata:
name: my-minio-dist-xl
spec:
type: NodePort
ports:
- port: 9000
selector:
app: my-minio-dist-xl
- Run below command to know the port the above service exposed.
kubectl get services/my-minio-dist-xl -o go-template='{{(index .spec.ports 0).nodePort}}'
- Use this port in the endpoint
http://minikube:<EXPOSED-PORT>