@@ -22,9 +22,9 @@ reinitialized to its initial state with just a single command.
22
22
## Requirements
23
23
24
24
### 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
28
28
29
29
### Nodes
30
30
- Raspberri Pi 4b
@@ -36,9 +36,11 @@ docker
36
36
Download a bootable Ubuntu image to be used as a base image for nodes. Latest
37
37
LTS build for Raspberry Pi is the primary testing target here, so it shoud work
38
38
best.
39
+
39
40
Write your build configuration to variables.cfg file. Use variables.cfg.example
40
41
file and "Settings" section for referrence. Minimum required settings are IMAGE
41
42
and K8S_VERSION.
43
+
42
44
While these two will allow you to build an image "just to give it a try", there
43
45
is at least one more thing to configure if you plan to use your cluster for
44
46
longer 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
47
49
and re-join the nodes. So it is strongly recommended that you create a static
48
50
IP-to-MAC bidning in your DHCP server, and/or create a DNS name for your master
49
51
node, and configure CONTROL_PLANE_ENDPOINT variable with this name.
52
+
50
53
More useful settings to improve the cluster maintainability, like setting a
51
54
non-default password for login user, can be found under "Settings" section.
52
55
53
56
### Bootstrapping master node
54
57
After you configured your variables.cfg, it is time to bootstrap your master
55
58
node as the fist node in your cluster. If you are reusing variables.cfg from
56
59
another cluster, make sure that KUBEADM_JOIN_STRING is absent or set to empty.
60
+
57
61
This is what tells the scripts that this is the first boot, and the SD card
58
62
has to be partitioned for master-style layout, i.e. it should have an additional
59
63
partition for master data.
64
+
60
65
Build the image with
66
+ ```
61
67
bash ./build.sh
68
+ ```
69
+
62
70
Check the logs to make sure that all went well. There will be some errors caused
63
71
by building it in docker+chroot - these will be followed by a message that the
64
72
error can be safely ignored. Errors that do not have an explanation coming right
65
73
after them may be a sign of a broken build. Please report them, or, even better,
66
74
open a PR with a fix. Builds having such errors should not be used to update or
67
75
install the nodes unless you know what you do.
76
+
68
77
After a successful build, an image at ` images/bootable_image.img ` is ready to
69
78
be flashed on an SD card and used to boot your master node.
70
79
Bootup and initialization would take 5-15 minutes depending on the speed of
71
80
your SD card and internet connection (you will be downloading images for control
72
81
panel).
82
+
73
83
After successfull boot, you will be able to log in to your new master node with
74
84
the default user for your distriution (most likely "ubuntu"), and the default
75
85
password (usually ubuntu), or your custom password if you set it.
86
+
76
87
Check /var/log/kubeadm.log to make sure the installation went well and grab the
77
88
admin context from /etd/kubernetes/admin.conf.
89
+
78
90
A command to join new nodes to the cluster is stored at /usr/lib/k8r/join_string
79
91
Update your variables.cfg file and set this command as a value of parameter
80
92
KUBEADM_JOIN_STRING.
@@ -83,11 +95,13 @@ KUBEADM_JOIN_STRING.
83
95
With KUBEADM_JOIN_STRING in variables.cfg file set to the value from previous
84
96
step, re-run the build process by executing
85
97
bash ./build.sh
98
+
86
99
This will build the image again with the new variables file (just injecting it
87
100
is not implemented yet), creating a new images/bootable_image.img which you can
88
101
use for initial bootstrap of the worker nodes, along with two more images,
89
102
` images/boot.img.xz ` and ` images/image.img.xz ` which can be used to upgrade, as
90
103
well as to downgrade the nodes.
104
+
91
105
Now you can write bootable-image.img to SD cards of as many new nodes as you
92
106
need, boot them, and have them joined your new cluster. Enjoy! :-)
93
107
@@ -99,7 +113,8 @@ nodes, of by having the nodes download the updated image from HTTP location.
99
113
To upgrade the nodes using local images, transfer updated images/boot.img.xz
100
114
and images/image.img.xz so some location on the node, and write it to image
101
115
partition 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
+
103
118
For example, if image.img.xz (boot.img.xz should be stored under the same
104
119
location) can be found at ` /home/ubuntu/new_images/image.img.xz ` on the target
105
120
node, then the command would look like this:
@@ -109,6 +124,7 @@ bash /usr/lib/k8r/tasks/update_image_partition.sh /home/ubuntu/new_images/
109
124
110
125
To upgrade the node from images from an HTTP, location, you need to have a
111
126
variable HTTP_IMAGE_URL set to proper location in your ` variables.cfg ` file.
127
+
112
128
This can be preconfigured during the build step, and you can change it or set
113
129
it on the target node anytime by editing ` /usr/lib/k8s/variables.cfg ` file.
114
130
As an example, if you have your image.img.xz (same for boot.img.xz) available
@@ -211,19 +227,25 @@ various scripts
211
227
without parameters, will try to download an image from HTTP_IMAGE_URL. To use
212
228
an image from a local FS, use directory path as a parameter. The directory must
213
229
contain both image.img.xz and boot.img.xz files.
230
+
214
231
` set_reinstall_mode.sh ` - restart and reinstall the node. Boot and root
215
232
filesystems will be rewritten using an initial image, resulting in a fresh node.
216
233
217
234
#### NOT intended for use by an operator:
218
235
` install-docker.sh ` : convenience script to install docker into build containers.
219
236
Runs on build host.
237
+
220
238
` bootstrap_image.sh ` : runs basic software installation and configuration during
221
239
build process. Runs on build host.
240
+
222
241
` setup_partitions.sh ` : creates required partitions inside image file. Runs on
223
242
build host.
243
+
224
244
` reboot.sh ` : utility wrapper used by task_runner's scripts to reboot the node.
245
+
225
246
` setup_node.sh ` : run minimal preparations on the node during install process and
226
247
trigger an appropriate next phase
248
+
227
249
` bootstrap_master.sh ` : if node is expected to be a master, configure and start
228
250
k8s control plane
229
251
0 commit comments