This time I will show you how to install Kuberetes
on Raspberry PI 4.
First step is to download special ubuntu image
for raspberry PI from the official site.
Where are two version for it, 32 and 64 bit,
We are going to use the second one (64 bit image)
image)
When the download process will be finished,
find it and and unpack it.
The easiest way how to write the image to
the flash card is Atcher, so we will use it.
This is pretty simple process, you only need
to provide file it-self, select the flash
card
on which we are going to write the image and
confirm the action.
the process will take about 10 minutes.
When the process will be finish, remove the
flashcard from the reader and insert it to
the raspberry PI, plug-in the power cable
and wait about 20 seconds.
You can find the IP address on the router,
for example on your home router it-self.
To make the installation process universal
(don't have any dependences on the operation
system which users currently have) we are
going to use local docker.
We will use image from Ubuntu version 20.4
Since the image is totally new we need to
connect it to the official repositories for
updating and update it.
Additionally we need to install pyhton3-pip
git vim editor and curl (we will need it's
during the installation process)
Since we are going to use Kubespray for the
kubernetes installation and it uses under
the hood Ansible as the automation tools,
it requires to be able to connect to raspberry
PI without password, just by using RSA key,
so let's begin and generate the key paar
Now we are going to connect to the paspbeerry
PI for the first time by using the credential
pair ubuntu/ubuntu, the system will ask us
to set new password.
Next step is to upload the rsa public key
to the raspberry PI.
We will use copy-id command to do it.
Finally let's check if we can login into the
device without password at all.
Good, we are on the device.
now it's the time for making the customisation
a bit.
First of all we need to fix the IP address
on the device (currently it's DHCP), So we
will update cloud-init yaml file. and set
it statically IP address.
Second step is to add few firmware specific
parameters to the cmd file, this customisation
will be used by kubernetes cluster.
To prepare the device for installation we
need to update the operating system and installpython3-pip,
plus git client.
By the way, setting the kernel specific parameters
is mandatory.
please don't run the installation installation
process without it.
Then the updating process will be finished
we must reboot the device to make apply kernel
specific features before running the kubernetes
installation.
Perfect, when the device will come back from
the rebooting process, let's login again and
check if everything is ok, we can run htop
command to see all CPU, we will run df -h
to see the used and free space.
let's leave the device and go back to the
installation process.
Let's clone the official kubespray repository
and checkout to the last release, today it's
v2.13.0.
The installer has some requirements regarding
the python modules which suppose to be
install, let's install it.
Super, the next steps will be to follow kubespay
installation instruction.
We need to create a copy of example invetory,
next step we need to declare the IP address
of our raspberry device as a kubernetes node,
next one is create the configuration file.
Unfortunately, to be able to run the kubespray
installer for raspberry pi we need to make
few small fixes, the first one is that we
need to change the name of the python packet
which suppose to be installed, let's switch
it from python2 version to python3
The second option which must be updated is
inventory it-self, we need to set the name
of the user which will be used for authentication
on the device.
The final step is the starting the installation
process.
Apart of the main command we must specify
few additional parameters.
ansible_distribution_release = bionic this
code belongs to ubuntu 18 version, currently
there are no images in the docker hub for
ubuntu 20.04
kube_resolv_conf must set to special value,
over-wise the core-dns pod will be crashed
permanently by loop detecting reason.
local_path_provisioner_enabled, should be
activated and we will be able to install software
right than the installation will be finished,
and this provisioner will be set a default
storage class.
Perfect the installation process was finished.
Let's run few simple command which let us
transfer kubernetes config file from raspberry
device to local container.
additionally to be able to manage kubernetes
cluster we must install kubectl utility.
so, Let's download the module, move it to
the proper folder set the permissions and
start using it.
Let's make small turning right now:
Our kubernetes cluster has only one node and
we are not going to have more, so we will
remove dns-sutoscaler and decrease count of
code-dns replicas from two to one.
As you can see now, all pods are running and
there is no pod in status pending.
Now let's install metallb which will let us
to receive incoming traffic to the cluster.
We need to create configmap manually and apply
it to the cluster.
We need to set the range of IP addresses from
our local IP network which will be use for
Loadbalancer.
As you can see the metallb loadbalancer was
successfully installed and running.
The next step will be to install ingress controller
which let us forward incoming request to proper
services.
We will use HELM as the install for this.
so let's go and download helm and move binary
to right folder.
When the helm is in the right place let's
use it for installing ingress controller.
The important option here is the controller
image repository, we must set different image
which can works or ARM64 processors
As you can see, right after installing the
ingress controller, it requested the external
IP from metallb and successfully got it.
it few seconds pod of the ingress controller
will be started cusseccfully.
And tactically when we will try to open URI
by easily using external IP address of the
ingress controller we will see the it's reachable
but there are no services currently available.
It's error message, but it means that ingress
controller is reachable.
Now let me show you how many device resourced
we used for kubernetes cluster.
By the way the device has 4Gb memory and 4
vCPU.
Currently 33% of CPU 19% of Memory requested,
so the rest resources could be used for other
application.
Now, let me say my personal opinion on this
solution.
Right not the installer number is HELM, and
I found that this is really the mission impossible
to find charts which already support images
for ARM64 processors.
Probably the situation will be changed soon
it this direction.
Anyway you can build your own images and use
it, but in my humble opinion just think twice
before even try to install kubernetes on the
raspberry, that's possible however what's
your main goal?
Thank for for watching.
