Skip to content

Instantly share code, notes, and snippets.

@neklaf
Last active February 9, 2020 07:38
Show Gist options
  • Save neklaf/92ff1b15b26c8bd42feb5755586d1af5 to your computer and use it in GitHub Desktop.
Save neklaf/92ff1b15b26c8bd42feb5755586d1af5 to your computer and use it in GitHub Desktop.
Script to setup packages needed to install a K8s node v 1.15.00
#!/bin/sh
sudo apt update && sudo apt upgrade
sudo apt install -y docker.io curl sudo vim
sudo cat > /etc/docker/daemon.json <<EOF
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
EOF
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo iptables -F
sudo iptables -X
sudo iptables -t nat -F
sudo iptables -t nat -X
sudo iptables -t mangle -F
sudo iptables -t mangle -X
sudo iptables -P INPUT ACCEPT
sudo iptables -P OUTPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo apt update && sudo apt install -y apt-transport-https gpg
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
sudo apt update
sudo apt install -y kubelet=1.15.0-00 kubeadm=1.15.0-00 kubectl=1.15.0-00
sudo apt-mark hold kubelet kubeadm kubectl
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
sudo update-alternatives --set arptables /usr/sbin/arptables-legacy
sudo update-alternatives --set ebtables /usr/sbin/ebtables-legacy
@neklaf
Copy link
Author

neklaf commented Nov 24, 2019

This script has been create to install a lab to prepare CKA, at this time Kubernetes version covered by exam is 1.15.0, so if you need a different K8s version you should change a bit the script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment