big bang
This commit is contained in:
commit
c864e76a2d
1
container/Dockerfile
Normal file
1
container/Dockerfile
Normal file
@ -0,0 +1 @@
|
|||||||
|
FROM glmdev/k8s-hpc-demo:latest
|
18
definitions/account_definitions.yaml
Normal file
18
definitions/account_definitions.yaml
Normal 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
definitions/cluster_definition.yaml
Normal file
31
definitions/cluster_definition.yaml
Normal 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
definitions/namespace_definition.yaml
Normal file
6
definitions/namespace_definition.yaml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: cluster
|
||||||
|
labels:
|
||||||
|
name: cluster
|
3
run_cluster.sh
Executable file
3
run_cluster.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
kubectl -n cluster exec cluster-master -i --tty -- $@
|
12
setup.sh
Executable file
12
setup.sh
Executable 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
14
start_cluster.sh
Executable 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
13
stop_cluster.sh
Executable 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…
Reference in New Issue
Block a user