Litecoin Inference Kubernetes Cluster

 When I started this project, I had been looking at small Kubernetes clusters to make for my home lab. The issue was the size and power required to run them. In my bachelor days, I once owned a fully enclosed computer rack on wheels, which lived in the corner of my bachelor pad dining room. It was full of salvaged HP, Cisco, SGI, and Sun hardware from the dot.com crash. It's a true story; running it costs me about $300 extra monthly in power. When I got married, the spousal acceptance level of such a setup was a non-starter. Which made me rethink the whole X86 architecture or other rack-mounted hardware for a home lab. Linux has been running on ARM for a long time, and most significant projects have arm ports. This is fueled by the AWS Graviton platform and Apple's move to ARM-based M1 and M2 chips.  

In 2019 Raspberry Pi 4B option came out with some decent specs:

Cortex-A72 (ARM v8) 64-bit SoC @ 1.5GHz, 8GB RAM, 2 USB 3.0, and a fast Micro-SD card slot.

Also, Google released a very cool little project called Coral TPU.

It's a USB 3.0 TPU

https://coral.ai/products/accelerator

Google Edge TPU coprocessor:

4 TOPS (int8); 2 TOPS per watt 

With the USB 3.0 support, unleashing the TPU's power made sense. It's like running Nivida GTX 1080 on a Rasberry Pi. Here is a link to a great benchmark article. So now I had a good home lab hardware platform to start my experiments on. 

I have followed Picocluster Raspberry Pi cluster for a few years. I liked the elegant design of the cases and setups, including the power supply, network switch, chassis, and cooling system. So I took the plunge last year. I have a five-node Rasberry Pi 4B 8GB cluster running 64bit Pi Lite OS on my desk in front of me, costing about 1200 dollars. I did do a minor upgrade. I replaced the stock Picocluster 80mm with a Noctua NF-R8 fan, which was quieter.




 The first node is my gateway and command model that allows SSH access and port forwarding to my kids (Minecraft server, Jnotebook, Grafana running in my cluster, and the Python jobs). 

The first node also holds the marina DB for all the storage for the jobs I will run. That leaves me with four nodes to run as a K3s cluster. A Kubernetes distro by Rancher Labs owned by Suse Linux. 

K3s is an excellent kubernets cluster. I have worked with Minikube, MicroK8s, and K3s and found K3s to be more sturdy and stable than MicroK8s. Of the two with multinode support, I chose K3s over MicroK8s. I am considering trying out Sidero Metal, but that will likely be for a different project. 

I started using Argocd for cluster state/deployment management and Airflow for CI/CD (tech I use at work ) but found that I was doing too much and using too much of my limited resources, so I settled on Python scripts and Kubernetes cron jobs for job execution. If a job failed, it would launch on another node, more reliable than the services it was pulling from. A minor two-day outage of the sentiment API around Christmas, a Twitter hiccup here and there, and a Yahoo finance update required a pip lib update to get the script going. After 6 months, I had a training data set, and my Twitter API stopped because of policy Twitter API Term of service changes. So my account only captured via free API account 8 months of data.  

Now let's work on getting that data!





 

Comments

Popular posts from this blog

Litecoin Data Collection and saved data features

CodeLlama for DevOps massive productivity hack.

DevOps LLM shootout TLDR