Last active
May 10, 2019 16:44
-
-
Save dracan/9c116a56ef08284d820064e9a208bca1 to your computer and use it in GitHub Desktop.
Install Kubernetes
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 | |
# Pre-pull the requisites Docker images needed to run a Kubernetes master | |
kubeadm config images pull -v3 | |
# Init master node | |
kubeadm init --token-ttl=0 --pod-network-cidr=10.244.0.0/16 # This uses the Flannel pod network addon | |
# Setup local access to the cluster via the kubectl command | |
mkdir -p $HOME/.kube | |
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config | |
chown $(id -u):$(id -g) $HOME/.kube/config | |
# Install the pod network-addon | |
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml |
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 | |
# Install Docker | |
curl -sSL get.docker.com | sh && \ | |
sudo usermod pi -aG docker | |
# Disable swap (needs to be off for Kubernetes) | |
sudo dphys-swapfile swapoff && \ | |
sudo dphys-swapfile uninstall && \ | |
sudo update-rc.d dphys-swapfile remove | |
# Install Kubeadm | |
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 | |
# Enable cgroups | |
echo Adding " cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory" 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 cgroup_enable=memory" | |
echo $orig | sudo tee /boot/cmdline.txt | |
# Required for the Flannel network-addon | |
sysctl net.bridge.bridge-nf-call-iptables=1 | |
echo Please reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment