Skip to content

Instantly share code, notes, and snippets.

@mccrackend
Last active June 26, 2021 14:01
Show Gist options
  • Save mccrackend/b9790d69337cec3da333c834971a50a7 to your computer and use it in GitHub Desktop.
Save mccrackend/b9790d69337cec3da333c834971a50a7 to your computer and use it in GitHub Desktop.
DevsOperative Days - Rpi Setup
Step 1 - Flash the SSD with an operating system
Official RaspberryPi.org Imager Tool
https://bit.ly/3qmmmOd
Step 2 - Power On, Change Hostnames, Assign Static IPs
ssh ubuntu@<Initial_IP_Address>
sudo vim /etc/hostname
sudo reboot now
Step 3 - Update & Upgrade apt packages
https://bit.ly/3cSRGyy
sudo apt update && sudo apt upgrade && sudo reboot now
Step 4 - Install & Configure Docker
sudo su -
apt install -y docker.io
cat > /etc/docker/daemon.json <<EOF
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
EOF
Step 5 - Configure Ubuntu Kernel Parameters
https://bit.ly/3xxUdpt
sudo sed -i '$ s/$/ cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1 swapaccount=1/' /boot/firmware/cmdline.txt
echo "overlay" | sudo tee -a /etc/modules
echo "br_netfilter" | sudo tee -a /etc/modules
modprobe overlay
modprobe br_netfilter
Step 6 - Configure sysctl and enable Docker service
cat > /etc/sysctl.d/99-kubernetes-cri.conf <<EOF
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
EOF
sysctl --system
systemctl enable docker.service
reboot now
Step 7 - Install Kubernetes Binaries
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 kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
Step 8 - Create Cluster Controller
TOKEN=$(sudo kubeadm token generate) && echo $TOKEN
sudo kubeadm init --token=${TOKEN} --pod-network-cidr=10.244.0.0/16
kubectl --kubeconfig=/etc/kubernetes/admin.conf get nodes
Step 9 - Add Worker To Cluster
kubeadm join 192.168.1.x --token <token> --discovery-token-ca-cert-hash <hash>
kubectl --kubeconfig=/etc/kubernetes/admin.conf get nodes
Step 10 - Install a CNI
https://github.com/flannel-io/flannel
kubectl --kubeconfig=/etc/kubernetes/admin.conf apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
Step 11 - Validation!
Kubectl get nodes
Kubectl get events
Kubectl create deployment nginx --image=nginx
Kubectl get pods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment