- Setup static IP address on the machine
- Run the following script install Docker daemon and Kubeadm
sudo apt-get update
sudo apt-get install -y vim apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
sudo usermod -aG docker $USER
sudo swapoff --all
sudo sed -i '$ d' /etc/fstab
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get install -qy kubeadm
- Flash Raspberry Pi with Raspbian Stretch Download
- Run the script below to set static IP address to the Pi. Change IP address and router address depend on your preferences.
cat << EOF | sudo tee -a /etc/dhcpcd.conf
interface eth0
static ip_address=192.168.99.21/24
static routers=192.168.99.1
static domain_name_servers=8.8.8.8
interface wlan0
static ip_address=192.168.99.31/24
static routers=192.168.99.1
static domain_name_servers=8.8.8.8
EOF
- Run
sudo raspi-config
- Configure host name and wifi in Network Options
- Configure localization: Enable en_US.UTF-8 and th_TH.UTF-8 and set default to en_US.UTF-8
- Reboot the Pi
- Run the following script to install Docker and disable swap
sudo apt-get update
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
sudo swapoff -a
sudo systemctl disable dphys-swapfile.service
- Edit file
/boot/cmdline.txt
anda ppendcgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory
to the end of the first line. - Reboot the Pi
- Run the following script to install
kubeadm
cat << EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get install -qy kubeadm
Click here to see the steps to create high availability kubernetes cluster with HAProxy load balancer.
wget -O- https://raw.githubusercontent.com/sunboyy/noomnim-chat-k8s-pi/master/k8s-deploy.sh | bash -