Running Rust on ARM32v7 K3S Oracle cluster.


In this article we will explore how to create a sample Rust project and Dockerfile to run it on ARM32v7 architectures.

To configure the cluster I used this project k3s-oci-cluster, since Oracle is providing a very generous free tier for ARM workloads you might as well give it a try, or maybe use your raspberry pi cluster.

The source for this article is here RCV and the docker image is here.


The cluster is optional if you have any device using linux on ARM32v7 or ARM64v8 you should be able to use the docker examples.

Let’s jump to the example

Creating the project

Lets create a new Rust project with Cargo, as you might notice we will get a very basic project that will help us get get started:

Our example and the dependencies

I was thinking in processing markdown files and show them as html, so that’s basically what the code does, it’s far from optimal but it is good enough to illustrate the example, first lets add some crates for the webserver (Actix) and converting markdown to html.

Lets add some code

This simple snippet only listens for GET requests to / and logs a line with the unix timestamp and IP and returns the contents of the file which is my Curriculum Vitae.

Example logs

Example logs

At this point we have enough to run and test locally, but what about other architectures? (I’m running on linux-amd64), you can test it locally if you want running cargo run.

ARM32v7 Dockerfile

This Dockerfile can be optimized and secured in many ways, but for the sake of simplicity it is good enough to start working on something, also we will provide the security at runtime via kubernetes APIs. We need to consider two things here, first we need to create an ARM32v7 binary using Rust, then we need a Docker image for that architecture so that’s basically what the Dockerfile does.

Building and pushing (docker image)

So lets build it and push it here.

lets quickly review the manifests

The manifests are fairly simple, you can see them there, as you can see we are restricting the user and privileges of the container using the SecurityContext of the pod and the container.

Deploying it

Assuming you already have a cluster up and running, this can be deployed like this, you will see a deployment, a service and the ingress resources, you will also need to have a DNS entry if you want to use it like I did there:


You can see it running here, a very basic HTML Curriculum vitae, if it doesn’t work don’t worry too much, I’m planning on upgrading the cluster and adding https to the example for another article, it will eventually be back up, however if you want to see it anyway, try running the example and building the image on your machine.

For more details and to see how everything fits together I encourage you to clone the repo, test it, and modify it to make your own.

Cleaning up

To clean up the resources you can do this:

Closing notes

Be sure to check the links if you want to learn more about the examples, I hope you enjoyed it, see you on twitter or github!

The source for this article is here


If you spot any error or have any suggestion, please send me a message so it gets fixed.

Also, you can check the source code and changes in the generated code and the sources here