This document refers to open source document opsnull/follow-me-install-kubernetes-cluster, which aims to use shell scripts on the Raspberry Pi, semi-automatically Build a highly available cluster.
Raspberry Pi 4 model B
Ubuntu Server 20.04.2 LTS
- k8s-01: 192.168.11.30
- k8s-02: 192.168.11.31
- k8s-03: 192.168.11.32
Topology
The three devices are both Master nodes and Worker nodes. The following operations are performed on each node.
hostnamectl set-hostname k8s-01 # The host names of different nodes are different, take k8s-01 as an example
If DNS does not support host name resolution, you also need to add the correspondence between host name and IP in the /etc/hosts
file of each machine:
cat >> /etc/hosts <<EOF
192.168.11.30 k8s-01
192.168.11.31 k8s-02
192.168.11.32 k8s-03
EOF
Log out and log in to the root account again, and you can see that the host name takes effect.
This operation only needs to be performed on the k8s01 node, and the root account can be set to log in all nodes without a password:
ssh-keygen -t rsa
ssh-copy-id root@k8s-01
ssh-copy-id root@k8s-02
ssh-copy-id root@k8s-03
After performing the above operations, please perform the following operations.
Step 1: Execute the script 1.system_environment.sh on all nodes
Step 2: Execute the following 4 scripts on the k8s-01 node
Note: Before executing these scripts, you need to change the cluster node IP in the script to the actual node IP