Browse Source

big bang

master
Garrett Mills 2 years ago
commit
c864e76a2d
8 changed files with 98 additions and 0 deletions
  1. +1
    -0
      container/Dockerfile
  2. +18
    -0
      definitions/account_definitions.yaml
  3. +31
    -0
      definitions/cluster_definition.yaml
  4. +6
    -0
      definitions/namespace_definition.yaml
  5. +3
    -0
      run_cluster.sh
  6. +12
    -0
      setup.sh
  7. +14
    -0
      start_cluster.sh
  8. +13
    -0
      stop_cluster.sh

+ 1
- 0
container/Dockerfile View File

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

+ 18
- 0
definitions/account_definitions.yaml 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

+ 31
- 0
definitions/cluster_definition.yaml 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

+ 6
- 0
definitions/namespace_definition.yaml View File

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

+ 3
- 0
run_cluster.sh View File

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

+ 12
- 0
setup.sh 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
- 0
start_cluster.sh 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
- 0
stop_cluster.sh 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

Loading…
Cancel
Save