Last active
December 19, 2017 15:59
-
-
Save BlairLeduc/a4902eec6686322975f7e9e5732990b3 to your computer and use it in GitHub Desktop.
Installs Docker and Kubernetes on a Raspberry Pi running Stretch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This installs the base instructions up to the point of joining / creating a cluster | |
curl -sSL get.docker.com | sh && sudo usermod pi -aG docker | |
sudo dphys-swapfile swapoff && \ | |
sudo dphys-swapfile uninstall && \ | |
sudo update-rc.d dphys-swapfile remove | |
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - && \ | |
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list && \ | |
sudo apt-get update -q && \ | |
sudo apt-get install -qy kubeadm | |
echo Adding " cgroup_enable=cpuset cgroup_memory=1" to /boot/cmdline.txt | |
sudo cp /boot/cmdline.txt /boot/cmdline_backup.txt | |
orig="$(head -n1 /boot/cmdline.txt) cgroup_enable=cpuset cgroup_memory=1" | |
echo $orig | sudo tee /boot/cmdline.txt | |
echo Please reboot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: markdownrender | |
labels: | |
app: markdownrender | |
spec: | |
type: NodePort | |
ports: | |
- port: 8080 | |
protocol: TCP | |
targetPort: 8080 | |
nodePort: 31118 | |
selector: | |
app: markdownrender | |
--- | |
apiVersion: apps/v1beta1 # for versions before 1.6.0 use extensions/v1beta1 | |
kind: Deployment | |
metadata: | |
name: markdownrender | |
spec: | |
replicas: 1 | |
template: | |
metadata: | |
labels: | |
app: markdownrender | |
spec: | |
containers: | |
- name: markdownrender | |
image: functions/markdownrender:latest-armhf | |
imagePullPolicy: Always | |
ports: | |
- containerPort: 8080 | |
protocol: TCP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
HOST=$1 | |
if [ "$1" = "" ]; then | |
echo "Need host name of node." | |
else | |
echo "Placing $HOST into maintenance mode." | |
kubectl drain $HOST --ignore-daemonsets | |
echo "Upgrading node." | |
ssh pi@$HOST.local 'sudo apt-get -q update && sudo apt-get -y upgrade && systemctl status kubelet | grep Active:' | |
echo "Bringing $HOST back online" | |
kubectl uncordon $HOST | |
echo "Rebooting $HOST." | |
ssh pi@$HOST.local 'sudo reboot' | |
echo "Upgrade of $HOST complete." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment