@@ -22,9 +22,9 @@ reinitialized to its initial state with just a single command.
2222## Requirements
2323
2424### Build Platform
25- Linux or MacOS in arm64 or x86_64
26- docker
27- 15G free space to contain initial, intermediate, and final images
25+ - Linux or MacOS on arm64 or x86_64
26+ - docker
27+ - 15G free space to contain initial, intermediate, and final images
2828
2929### Nodes
3030- Raspberri Pi 4b
@@ -36,9 +36,11 @@ docker
3636Download a bootable Ubuntu image to be used as a base image for nodes. Latest
3737LTS build for Raspberry Pi is the primary testing target here, so it shoud work
3838best.
39+
3940Write your build configuration to variables.cfg file. Use variables.cfg.example
4041file and "Settings" section for referrence. Minimum required settings are IMAGE
4142and K8S_VERSION.
43+
4244While these two will allow you to build an image "just to give it a try", there
4345is at least one more thing to configure if you plan to use your cluster for
4446longer period of time. The cluster's certificates include IP address of master
@@ -47,34 +49,44 @@ address of master node changes, you might have to rebuild all the cluster certs
4749and re-join the nodes. So it is strongly recommended that you create a static
4850IP-to-MAC bidning in your DHCP server, and/or create a DNS name for your master
4951node, and configure CONTROL_PLANE_ENDPOINT variable with this name.
52+
5053More useful settings to improve the cluster maintainability, like setting a
5154non-default password for login user, can be found under "Settings" section.
5255
5356### Bootstrapping master node
5457After you configured your variables.cfg, it is time to bootstrap your master
5558node as the fist node in your cluster. If you are reusing variables.cfg from
5659another cluster, make sure that KUBEADM_JOIN_STRING is absent or set to empty.
60+
5761This is what tells the scripts that this is the first boot, and the SD card
5862has to be partitioned for master-style layout, i.e. it should have an additional
5963partition for master data.
64+
6065Build the image with
66+ ```
6167bash ./build.sh
68+ ```
69+
6270Check the logs to make sure that all went well. There will be some errors caused
6371by building it in docker+chroot - these will be followed by a message that the
6472error can be safely ignored. Errors that do not have an explanation coming right
6573after them may be a sign of a broken build. Please report them, or, even better,
6674open a PR with a fix. Builds having such errors should not be used to update or
6775install the nodes unless you know what you do.
76+
6877After a successful build, an image at ` images/bootable_image.img ` is ready to
6978be flashed on an SD card and used to boot your master node.
7079Bootup and initialization would take 5-15 minutes depending on the speed of
7180your SD card and internet connection (you will be downloading images for control
7281panel).
82+
7383After successfull boot, you will be able to log in to your new master node with
7484the default user for your distriution (most likely "ubuntu"), and the default
7585password (usually ubuntu), or your custom password if you set it.
86+
7687Check /var/log/kubeadm.log to make sure the installation went well and grab the
7788admin context from /etd/kubernetes/admin.conf.
89+
7890A command to join new nodes to the cluster is stored at /usr/lib/k8r/join_string
7991Update your variables.cfg file and set this command as a value of parameter
8092KUBEADM_JOIN_STRING.
@@ -83,11 +95,13 @@ KUBEADM_JOIN_STRING.
8395With KUBEADM_JOIN_STRING in variables.cfg file set to the value from previous
8496step, re-run the build process by executing
8597bash ./build.sh
98+
8699This will build the image again with the new variables file (just injecting it
87100is not implemented yet), creating a new images/bootable_image.img which you can
88101use for initial bootstrap of the worker nodes, along with two more images,
89102` images/boot.img.xz ` and ` images/image.img.xz ` which can be used to upgrade, as
90103well as to downgrade the nodes.
104+
91105Now you can write bootable-image.img to SD cards of as many new nodes as you
92106need, boot them, and have them joined your new cluster. Enjoy! :-)
93107
@@ -99,7 +113,8 @@ nodes, of by having the nodes download the updated image from HTTP location.
99113To upgrade the nodes using local images, transfer updated images/boot.img.xz
100114and images/image.img.xz so some location on the node, and write it to image
101115partition with ` update_image_partition.sh ` script from ` /usr/lib/k8r/tasks `
102- directory, passing a directory where the images can be found as a parameter.
116+ directory, passing a directory where the images can be found as a parameter.
117+
103118For example, if image.img.xz (boot.img.xz should be stored under the same
104119location) can be found at ` /home/ubuntu/new_images/image.img.xz ` on the target
105120node, then the command would look like this:
@@ -109,6 +124,7 @@ bash /usr/lib/k8r/tasks/update_image_partition.sh /home/ubuntu/new_images/
109124
110125To upgrade the node from images from an HTTP, location, you need to have a
111126variable HTTP_IMAGE_URL set to proper location in your ` variables.cfg ` file.
127+
112128This can be preconfigured during the build step, and you can change it or set
113129it on the target node anytime by editing ` /usr/lib/k8s/variables.cfg ` file.
114130As an example, if you have your image.img.xz (same for boot.img.xz) available
@@ -211,19 +227,25 @@ various scripts
211227without parameters, will try to download an image from HTTP_IMAGE_URL. To use
212228an image from a local FS, use directory path as a parameter. The directory must
213229contain both image.img.xz and boot.img.xz files.
230+
214231` set_reinstall_mode.sh ` - restart and reinstall the node. Boot and root
215232filesystems will be rewritten using an initial image, resulting in a fresh node.
216233
217234#### NOT intended for use by an operator:
218235` install-docker.sh ` : convenience script to install docker into build containers.
219236Runs on build host.
237+
220238` bootstrap_image.sh ` : runs basic software installation and configuration during
221239build process. Runs on build host.
240+
222241` setup_partitions.sh ` : creates required partitions inside image file. Runs on
223242build host.
243+
224244` reboot.sh ` : utility wrapper used by task_runner's scripts to reboot the node.
245+
225246` setup_node.sh ` : run minimal preparations on the node during install process and
226247trigger an appropriate next phase
248+
227249` bootstrap_master.sh ` : if node is expected to be a master, configure and start
228250k8s control plane
229251
0 commit comments