This commit is contained in:
Garrett Mills 2019-04-30 13:21:03 -05:00
commit c864e76a2d
8 changed files with 98 additions and 0 deletions

1
container/Dockerfile Normal file
View File

@ -0,0 +1 @@
FROM glmdev/k8s-hpc-demo:latest

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
name: cluster
labels:
name: cluster

3
run_cluster.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
kubectl -n cluster exec cluster-master -i --tty -- $@

12
setup.sh Executable file
View File

@ -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."

14
start_cluster.sh Executable file
View File

@ -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

13
stop_cluster.sh Executable file
View File

@ -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