commit c864e76a2d266249541398dd66c7f91b94a03e45 Author: Garrett Mills Date: Tue Apr 30 13:21:03 2019 -0500 big bang diff --git a/container/Dockerfile b/container/Dockerfile new file mode 100644 index 0000000..44c5d00 --- /dev/null +++ b/container/Dockerfile @@ -0,0 +1 @@ +FROM glmdev/k8s-hpc-demo:latest diff --git a/definitions/account_definitions.yaml b/definitions/account_definitions.yaml new file mode 100644 index 0000000..0bd6657 --- /dev/null +++ b/definitions/account_definitions.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: default + namespace: cluster +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: cluster-admin +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: cluster-admin +subjects: + - kind: ServiceAccount + name: default + namespace: cluster diff --git a/definitions/cluster_definition.yaml b/definitions/cluster_definition.yaml new file mode 100644 index 0000000..cc9b8fd --- /dev/null +++ b/definitions/cluster_definition.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +image: + repository: glmdev/k8s-hpc-demo + tag: latest + # pullPolicy: Never + pullPolicy: IfNotPresent +networkPolicy: + enabled: false +sshGateway: + enabled: false +mpiMaster: + autoUpdateHostfile: + enabled: true + volumes: + - name: cache-volume + hostPath: + path: / + type: Directory + volumeMounts: + - mountPath: /clusterfs + name: cache-volume +mpiWorkers: + num: 5 + volumes: + - name: cache-volume + hostPath: + path: / + type: Directory + volumeMounts: + - mountPath: /clusterfs + name: cache-volume diff --git a/definitions/namespace_definition.yaml b/definitions/namespace_definition.yaml new file mode 100644 index 0000000..9487756 --- /dev/null +++ b/definitions/namespace_definition.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: cluster + labels: + name: cluster diff --git a/run_cluster.sh b/run_cluster.sh new file mode 100755 index 0000000..f630c9b --- /dev/null +++ b/run_cluster.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +kubectl -n cluster exec cluster-master -i --tty -- $@ diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..1f3cb4f --- /dev/null +++ b/setup.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Clone the kube-openmpi repo. This provides OpenMPI in the cluster. +git clone https://github.com/everpeace/kube-openmpi cluster + +cd cluster + +# Generate the SSH key used by the cluster nodes for MPI comm. +./gen-ssh-key.sh + + +echo "Open the definitions/cluster_definition.yaml file and point it to your container image." diff --git a/start_cluster.sh b/start_cluster.sh new file mode 100755 index 0000000..c67a829 --- /dev/null +++ b/start_cluster.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Create the Kubernetes resources. +kubectl create -f definitions/namespace_definition.yaml + +kubectl create -f definitions/account_definitions.yaml + +# Start the cluster. +cd cluster + +helm template chart --namespace cluster --name cluster -f ../definitions/cluster_definition.yaml -f ssh-key.yaml | kubectl -n cluster create -f - + +# Start watch to view cluster resource creation. +watch -n 0.5 kubectl -n cluster get pods -o wide diff --git a/stop_cluster.sh b/stop_cluster.sh new file mode 100755 index 0000000..acb6be4 --- /dev/null +++ b/stop_cluster.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Stop the cluster. +cd cluster + +helm template chart --namespace cluster --name cluster -f ../definitions/cluster_definition.yaml -f ssh-key.yaml | kubectl -n cluster delete -f - + +# Delete the Kubernetes resources. +cd .. + +kubectl delete -f definitions/account_definitions.yaml + +kubectl delete -f definitions/namespace_definition.yaml