diff --git a/samples/features/sql-big-data-cluster/deployment/kubeadm/ubuntu/local-storage-provisioner.yaml b/samples/features/sql-big-data-cluster/deployment/kubeadm/ubuntu/local-storage-provisioner.yaml new file mode 100644 index 00000000..fc010145 --- /dev/null +++ b/samples/features/sql-big-data-cluster/deployment/kubeadm/ubuntu/local-storage-provisioner.yaml @@ -0,0 +1,129 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: local-storage +--- +apiVersion: v1 +kind: Service +metadata: + name: local-volume-provisioner + namespace: local-storage + labels: + app: local-volume-provisioner +spec: + type: ClusterIP + selector: + app: local-volume-provisioner + ports: + - name: metrics + port: 8080 + protocol: TCP +--- +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: local-storage +provisioner: kubernetes.io/no-provisioner +volumeBindingMode: WaitForFirstConsumer +reclaimPolicy: Delete +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: local-provisioner-config + namespace: local-storage +data: + storageClassMap: | + local-storage: + hostDir: /mnt/local-storage + mountDir: /mnt/local-storage + blockCleanerCommand: + - "/scripts/shred.sh" + - "2" +--- +apiVersion: extensions/v1beta1 +kind: DaemonSet +metadata: + name: local-volume-provisioner + namespace: local-storage + labels: + app: local-volume-provisioner +spec: + selector: + matchLabels: + app: local-volume-provisioner + template: + metadata: + labels: + app: local-volume-provisioner + spec: + serviceAccountName: local-storage-admin + containers: + - image: "quay.io/external_storage/local-volume-provisioner:v2.1.0" + imagePullPolicy: "Always" + name: provisioner + securityContext: + privileged: true + env: + - name: MY_NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + volumeMounts: + - mountPath: /etc/provisioner/config + name: provisioner-config + readOnly: true + - mountPath: /mnt/local-storage + name: local-storage + mountPropagation: "HostToContainer" + volumes: + - name: provisioner-config + configMap: + name: local-provisioner-config + - name: local-storage + hostPath: + path: /mnt/local-storage +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: local-storage-admin + namespace: local-storage +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: local-storage-provisioner-pv-binding + namespace: local-storage +subjects: +- kind: ServiceAccount + name: local-storage-admin + namespace: local-storage +roleRef: + kind: ClusterRole + name: system:persistent-volume-provisioner + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: local-storage-provisioner-node-clusterrole + namespace: local-storage +rules: +- apiGroups: [""] + resources: ["nodes"] + verbs: ["get"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: local-storage-provisioner-node-binding + namespace: local-storage +subjects: +- kind: ServiceAccount + name: local-storage-admin + namespace: local-storage +roleRef: + kind: ClusterRole + name: local-storage-provisioner-node-clusterrole + apiGroup: rbac.authorization.k8s.io diff --git a/samples/features/sql-big-data-cluster/deployment/kubeadm/ubuntu/setup-volumes-agent.sh b/samples/features/sql-big-data-cluster/deployment/kubeadm/ubuntu/setup-volumes-agent.sh new file mode 100644 index 00000000..ef043336 --- /dev/null +++ b/samples/features/sql-big-data-cluster/deployment/kubeadm/ubuntu/setup-volumes-agent.sh @@ -0,0 +1,11 @@ +#!/bin/bash -e + +# num of persistent volumes +PV_COUNT=25 + +for i in $(seq 1 $PV_COUNT); do + vol="vol$i" + + mkdir -p /mnt/local-storage/$vol + mount --bind /mnt/local-storage/$vol /mnt/local-storage/$vol +done