Add MinIO Server with Kubernetes deployment 10/1710/1
authorChen, Tingjie <tingjie.chen@intel.com>
Mon, 16 Sep 2019 14:03:07 +0000 (14:03 +0000)
committerKuralamudhan Ramakrishnan <kuralamudhan.ramakrishnan@intel.com>
Wed, 2 Oct 2019 20:40:17 +0000 (13:40 -0700)
Since Local controller support one node only, deploy standalone mode.
Using local persistent volume instead of hostpath.

Signed-off-by: Chen, Tingjie <tingjie.chen@intel.com>
Change-Id: I91eaa7c14fdd112a8232e655b571ddeddfe5ccec

deploy/kud-plugin-addons/minio/install.sh [new file with mode: 0755]
deploy/kud-plugin-addons/minio/local-pv.yaml [new file with mode: 0644]
deploy/kud-plugin-addons/minio/local-pvc.yaml [new file with mode: 0644]
deploy/kud-plugin-addons/minio/local-sc.yaml [new file with mode: 0644]
deploy/kud-plugin-addons/minio/minio-deployment.yaml [new file with mode: 0644]
deploy/kud-plugin-addons/minio/minio-service.yaml [new file with mode: 0644]

diff --git a/deploy/kud-plugin-addons/minio/install.sh b/deploy/kud-plugin-addons/minio/install.sh
new file mode 100755 (executable)
index 0000000..f1a61ea
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# Make sure 64GB+ free space.
+
+echo "s"|sudo -S mkdir /mnt/minio
+
+# Create local-storage persistent volume first since not support dynamic provisioning.
+kubectl create -f local-pv.yaml
+
+# Create storage class for local-storage
+kubectl create -f local-sc.yaml
+
+# Create persistent volume claim for minio server
+kubectl create -f local-pvc.yaml
+
+# Create deployment of MinIO server
+kubectl create -f minio-deployment.yaml
+
+# Create service for MinIO
+kubectl create -f minio-service.yaml
+
diff --git a/deploy/kud-plugin-addons/minio/local-pv.yaml b/deploy/kud-plugin-addons/minio/local-pv.yaml
new file mode 100644 (file)
index 0000000..d273a0f
--- /dev/null
@@ -0,0 +1,23 @@
+apiVersion: v1
+kind: PersistentVolume
+metadata:
+  name: minio-pv
+spec:
+  capacity:
+    storage: 64Gi
+  volumeMode: Filesystem
+  accessModes:
+  - ReadWriteOnce
+  persistentVolumeReclaimPolicy: Delete
+  storageClassName: local-storage
+  local:
+    path: /mnt/minio
+  nodeAffinity:
+    required:
+      nodeSelectorTerms:
+      - matchExpressions:
+        - key: kubernetes.io/os
+          operator: In
+          values:
+          - linux
+
diff --git a/deploy/kud-plugin-addons/minio/local-pvc.yaml b/deploy/kud-plugin-addons/minio/local-pvc.yaml
new file mode 100644 (file)
index 0000000..923dd61
--- /dev/null
@@ -0,0 +1,12 @@
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+  name: minio-local-claim
+spec:
+  accessModes:
+  - ReadWriteOnce
+  resources:
+    requests:
+      storage: 64Gi
+  storageClassName: local-storage
+
diff --git a/deploy/kud-plugin-addons/minio/local-sc.yaml b/deploy/kud-plugin-addons/minio/local-sc.yaml
new file mode 100644 (file)
index 0000000..b442e77
--- /dev/null
@@ -0,0 +1,7 @@
+kind: StorageClass
+apiVersion: storage.k8s.io/v1
+metadata:
+  name: local-storage
+provisioner: kubernetes.io/no-provisioner
+volumeBindingMode: WaitForFirstConsumer
+
diff --git a/deploy/kud-plugin-addons/minio/minio-deployment.yaml b/deploy/kud-plugin-addons/minio/minio-deployment.yaml
new file mode 100644 (file)
index 0000000..373ba55
--- /dev/null
@@ -0,0 +1,44 @@
+apiVersion: apps/v1 #  for k8s versions before 1.9.0 use apps/v1beta2  and before 1.8.0 use extensions/v1beta1
+kind: Deployment
+metadata:
+  # This name uniquely identifies the Deployment
+  name: minio-deployment
+spec:
+  selector:
+    matchLabels:
+      app: minio
+  strategy:
+    type: Recreate
+  template:
+    metadata:
+      labels:
+        # Label is used as selector in the service.
+        app: minio
+    spec:
+      # Refer to the PVC created earlier
+      volumes:
+      - name: storage
+        persistentVolumeClaim:
+          # Name of the PVC created earlier
+          claimName: minio-local-claim
+      containers:
+      - name: minio
+        # Pulls the default Minio image from Docker Hub
+        image: minio/minio:latest
+        args:
+        - server
+        - /storage
+        env:
+        # Minio access key and secret key
+        - name: MINIO_ACCESS_KEY
+          value: "ICN-ACCESSKEYID"
+        - name: MINIO_SECRET_KEY
+          value: "ICN-SECRETACCESSKEY"
+        ports:
+        - containerPort: 9000
+          hostPort: 9000
+        # Mount the volume into the pod
+        volumeMounts:
+        - name: storage # must match the volume name, above
+          mountPath: "/storage"
+
diff --git a/deploy/kud-plugin-addons/minio/minio-service.yaml b/deploy/kud-plugin-addons/minio/minio-service.yaml
new file mode 100644 (file)
index 0000000..766a1a2
--- /dev/null
@@ -0,0 +1,13 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: minio-service
+spec:
+  type: LoadBalancer
+  ports:
+    - port: 9000
+      targetPort: 9000
+      protocol: TCP
+  selector:
+    app: minio
+