# Rancher + ARM

# Introduction

Thanks to the [Techno Tim](https://www.youtube.com/channel/UCOk-gHyjcWZNj3Br4oxwh0A) YouTube channel  I was exposed to [Rancher](https://rancher.com/), which for me was sensational. Coming from a background of a person who likes [Docker](https://www.docker.com/) but with ** ZERO ** knowledge of [Kubernetes](https://kubernetes.io/) -- besides from the fact that I knows that it exists and is a container orchestrator -- discovering a solution that reduces the complexity of using Kubernetes and at the same time being a guide to learn it, Rancher appeared at a good time for me to start learning Kubernetes.

Given this background, I wanted to get my hands on tinkering with the system but run it on my [Nanopi M4](https://www.friendlyarm.com/index.php?route=product/product&product_id=234) -- which is, IMO, the card with the best cost/benefit in the offers that use an ARM chip --; however the process documentation was not easy to find, I tried to follow [this](https://youtu.be/oILc0ywDVTk) tutorial for configuring it on an x86; problems arose, the errors were not clear and I was having my first contact with the platform. After a few hours of frustrating paths, a solution was found and the steps were outlined [in this Gist](https://gist.github.com/Fazendaaa/d41718af657718e10914fe83a1121773).

# Step by step

1. Download [Armbian](https://www.armbian.com/nanopi-m4/) -- I used the Bionic server
2. Use an ISO burner to burn the system to an SD Card -- I used [balenaEtcher](https://www.balena.io/etcher/)
3. SSH - the password is `1234` -- in your Nanopi with:
```shell
ssh -l root your.boar.ip.here
```
4. Create a user and log in again this time with the password you created in the previous step
5. Check and install updates:
```shell
sudo apt-get update
sudo apt-get upgrade -y
```
6. Install Docker:
```shell
curl https://get.docker.com | sh
```
7. Follow the steps to add your user to run Docker in superuser mode without having to invoke it
8. Start the Rancher:
```shell
docker run -d --restart=unless-stopped \
    --publish 80:80 \
    --publish 443: 443 \
    --volume /opt/rancher:/var/lib/rancher \
    --volume /lib64:/lib64 \
    --volume /etc /cni/:/etc/cni/ \
    rancher/rancher: v2.4.5-rc7
```
9. Open your browser and enter your Nanopi ip and follow the Rancher settings steps
10. [Extra Step] Always remember when uploading a service, to use `Network Provider` as` Flannel`:

![84968426-d75a2100-b0ec-11ea-9bdc-2285ee2fa74b.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1593141307218/0SGXDMFMw.png)

## Possible Fixes for Some Errors

If you experience problems during or after setup, you can follow these steps:

- Restart your card
- `sudo rm -r /etc/kubernetes`
- `sudo rm -r /var/lib/rancher`

# To Do

- Write another post on how to set up a [Raspberry Pi Zero W](https://www.raspberrypi.org/products/raspberry-pi-zero-w/) with a [MagicMirror](https://magicmirror.builders /)  client running on it and the server on the Rancher configured in this tutorial
- Test on a [Raspberry PI 4](https://www.raspberrypi.org/products/raspberry-pi-4-model-b/) and see if the process remains similar
- Test on a [Tinker Board](https://www.asus.com/br/Single-Board-Computer/Tinker-Board/)
- Build [Jenkigs](https://www.jenkins.io/) and/or [Chef](https://www.chef.io/) for ARM and see if they run with Rancher

## Appendix

I recommend configuring the following services now since Rancher is already running:

1. [Heimdall](https://youtu.be/PA01Z6-z8Qs)
2. [Pi-Hole](https://youtu.be/NRe2-vye3ik) - particularly I don't know if it works well in this scenario, as I use pfBlocker I didn't see the need to configure it, but if you don't have either, this one it would be a start

# References

- ["It beggars description."](https://www.flickr.com/photos/58753832@N05/49317984156) by [CarlH_](https://www.flickr.com/photos/58753832@N05) is licensed under [CC BY-ND 2.0](https://creativecommons.org/licenses/by-nd/2.0/)
- [Rancher 2 on Raspberry Pi 4 with RancherOS ARM64 fails to run # 21534](https://github.com/rancher/rancher/issues/21534#issuecomment-643865494)
- [Running on ARM64 (Experimental)](https://rancher.com/docs/rancher/v2.x/en/installation/options/arm64-platform/)
- [rancher/flannel-cni](https://github.com/rancher/flannel-cni)
- [Configuring flannel for container networking](https://coreos.com/flannel/docs/latest/flannel-config.html)
