Scripts to assist with the creation of a raspberry pi kubernetes cluster.
MIT License
Scripts to assist with the creation of a raspberry pi kubernetes cluster.
This repository will help and guide you on setting up a cluster with multiple raspberries pi.
Currently it can generate a master
and N
-workers
where N
is the number of
nodes chosen in the conf.json
.
It configures a DHCP server making the master
node start assigning IPs to the worker nodes.
It is expected for the raspberries to be connected to the same switch.
The eth0
interface should be reserved for the cluster.
The objective of this project is to make it easy to configure a cluster in order to start playing with Kubernetes.
git clone https://github.com/Woile/rpi-cluster-assistant.git
cd rpi-cluster-assistant/
./scripts/init
./scripts/flash-cluster
Once the SD cards have been flashed, plug them in the raspberries. I'd recommend starting with the SD containing the master node.
SSH
to the nodes.master
node with static IP 10.0.0.1
10.0.0.2
to 10.0.0.50
kubernetes
clusterflannel
, weavenet
Execute:
./scripts/init
Explanation:
Hypriot OS
and flash
.Before:
config.json
values.Execute:
./scripts/flash-cluster
Explanation:
Execute:
./scripts/assistant.py
Explanation:
conf.json
file is generated.Before:
config.json
values.Execute:
./scripts/flash-one
Explanation:
master
or worker
) chosen.Before:
conf.json
.wpa_passphrase
.Execute:
./scripts/render.py
Explanation:
conf.json
.output
folder.The configuration file can be created based on the conf.example.json
cp conf.example.json conf.json
All the values are required, if you don't know what to put, leave the default.
Variable | Description | Default |
---|---|---|
username |
The username used to log in to the node | hypriot |
wifi_ssid_name |
The name of your wifi | - |
wifi_password |
Raw password of your wifi | - |
wifi_country |
Country where you are, check the codes | NL |
ssh_public_key |
Public SSH Key to access from outside the nodes | ~/.ssh/id_rsa.pub |
hostname_prefix |
Name of the machine. It will look like: node-1
|
node |
number_of_nodes |
Number of raspberries to be flashed | 4 |
node_range_start |
Offset to the number of nodes. Example range: [5..8] with range start: 5
|
1 |
include_master |
Decide whether to flash a master node or only workers. |
true |
pod_network |
Pod Network. Options: weavenet , flannel
|
flannel |
/root/k8s-cluster
./home/<user>/k8s-config
Notes:
/root/k8s-cluster/kubeadm-init.out
because you willkubeadm join ...
after provisioning the worker nodes.Remember that this must be executed after running all the scripts above
/root/k8s-cluster
.kubeadm join ...
command which appears in the master node.You can run the addons included in /home/<user>/k8s-addons
.