I read a lot the last days about Kubernetes, Containers and how to create an Deployment for the Kubernetes cluster.
I do like to mention the content Jeff Geerling (geerlingguy) creates on his channels like Youtube, Blog or on GitHub. If you don’t have a clue whats going on Raspberry Pi and / or Kubernetes you should start here. He exlains the basics very well it really helped me lot. Thank you, Jeff.
The first thing to sort out was to find examples or How-to about creating a Docker Container for the BOINC client. There are some ready to use Containers available on Docker Hub but those have been build on other systems then a Raspberry Pi so they did not work for me. Finally I found the GitHub Project of user Adam Radocz about creating a BOINC client container. His arm64v8 Docker file created successfully a BOINC container. His build exposes the RPC Port outside the Container and also allows to set a certain GUI_RPC password for the BOINC Manager. Just run
docker build -t boinc/client -f Dockerfile.arm64v8 .
to build a dedicated Docker container suitable for your Raspberry Pi.
Docker will be deprecated from Kubernetes and also K3S is running the native container engine containerd. So the Docker Container we just build before has to be imported into the local containerd repository.
#export boinc docker image to file
docker save -o boincarm64v8.tar boinc/client
#delete any latest boinc/client image from local containerd repository
ctr image remove docker.io/boinc/client:latest
#import your image
sudo ctr i import boincarm64v8.tar
Your container image is now ready to use.
Next Question: How do we install it on the Kubernetes cluster and what the fuzz are these pods ? On Kubernetes your application (and also the container image) are deployed to you your nodes via an installation manifest. The manifest is written in yaml and defines the needs of your application. It creates and manages ressources of your application in the cluster. While I was looking Container creation examples I also found a manifest from GitHub User jaysgrant which deploys the standard Docker BOINC client to any Kubernetes Cluster. I just had to disable the pull requests from DockerHub for the BOINC client image. Instead the image should be fetched from the local repository when creating the application in the cluster.
The manifest creates out-of-the-box a single Pod with a running BOINC client on your cluster. You first have to create the namespace boinc
for you deployment, then you can apply this manifest to your Kubernetes cluster
#create the namespace
kubectl create namespace boinc
#deploy the manifest
kubectl apply -f boinc_client_non_gpu.yaml
You now can connect to the BOINC client inside your pod with you BOINC Manager and volunteer for your projects.
I will write a detailed How-To how to create your BOINC deployment on a Kubernetes cluster but I first want to test, clarify and sort some things out.