Skip to content

Commit

Permalink
Added cuda-init script for a worker and gitignore file
Browse files Browse the repository at this point in the history
I have added .DS_Store files to gitignore, since MacOSX throws them all over the place.

Furthermore, I added a init-worker-with-cuda.sh script, that initializes a worker with a fresh installation of cuda, nvidia drivers and more.

I hope that this will solve a few bugs.
  • Loading branch information
Langhalsdino committed Jun 20, 2017
1 parent 8b40aaf commit 0df4d84
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## .DS_Store files of MacOsX
*.DS_Store
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ Be aware that the following sections might be opinionated. Kubernetes is an evol
- [Use fast setup script](#fast-track---setup-script)
- [Manually step by step instructions](#detailed-step-by-step-instructions)
* [How to build your GPU container](#how-to-build-your-gpu-container)
- [Essential parts of .yml](#essential-parts-of-yml)
- [Example GPU deployment](#example-gpu-deployment)
- [Essential parts of .yml](#essential-parts-of-yml)
- [Example GPU deployment](#example-gpu-deployment)
* [Some helpful commands](#some-helpful-commands)
* [Acknowledgements](#acknowledgements)
* [Authors](#authors)
Expand Down Expand Up @@ -180,7 +180,7 @@ I will use wave-works, just because of my personal preference ;)
```
kubectl apply -f https://git.io/weave-kube-1.6
```
**5.II** You are ready to go, now check that pods that all pods are online to confirm that everything is working ;)
**7** You are ready to go, now check that pods that all pods are online to confirm that everything is working ;)
```
kubectl get pods --all-namespaces
```
Expand Down Expand Up @@ -280,7 +280,7 @@ export KUBECONFIG=~/.kube/admin.conf
```
You are ready to use kubectl on you local client.

**3.II** You can test by listing all your pods
**4** You can test by listing all your pods
```
kubectl get pods --all-namespaces
```
Expand Down
42 changes: 42 additions & 0 deletions scripts/init-worker-with-cuda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh
# Following arguments are necessary:
# 1. -> token , e.g. "f38242.e7f3XXXXXXXXe231e"
# 2. -> IP:port of the master
echo "The following token will be used: ${1}"
echo "The master nodes IP:Port is: ${2}"
sudo bash -c 'apt-get update && apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt-get update'
sudo apt-get install -y --allow-unauthenticated docker-engine
sudo apt-get install -y --allow-unauthenticated kubelet kubeadm kubectl kubernetes-cni
sudo groupadd docker
sudo usermod -aG docker $USER

# Install Cuda and Nvidia driver
sudo apt-get install linux-headers-$(uname -r)
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia-375
sudo apt-get install nvidia-cuda-dev nvidia-cuda-toolkit nvidia-nsight

sudo systemctl enable docker && systemctl start docker
sudo systemctl enable kubelet && systemctl start kubelet

echo 'You might need to reboot / relogin to make docker work correctly'

for file in /etc/systemd/system/kubelet.service.d/*-kubeadm.conf
do
echo "Found ${file}"
FILE_NAME=$file
done

echo "Chosen ${FILE_NAME} as kubeadm.conf"
sudo sed -i '/^ExecStart=\/usr\/bin\/kubelet/ s/$/ --feature-gates="Accelerators=true"/' ${FILE_NAME}

sudo systemctl daemon-reload
sudo systemctl restart kubelet

sudo kubeadm join --token $1 $2

0 comments on commit 0df4d84

Please sign in to comment.