How Raspberry Pi and Kubernetes work together
Blog: The Enterprise Project - Enterprise Technology
The Raspberry Pi is hardware, a single-board computer with an ARM-compatible CPU, while Kubernetes is software for running and managing containers.
They’re both popular: the Raspberry Pi hit the 30 million units shipped milestone near the end of 2019, and apparently has seen a new sales surge this year. Kubernetes adoption is growing leaps and bounds, too. The nature of their popularity differs, though.
The Raspberry Pi has become commonly associated with computer science education, especially in K-12 education, since their relative affordability makes these devices accessible. In general, the Raspberry Pi lends itself to the kinds of tinkering and project-based work that cultivates the curiosity and learning that draws many people to technology in the first place.
[ Want Raspberry Pi projects to try with kids? Check out these five cool project ideas. ]
Kubernetes, meanwhile, has become synonymous with containerization. In particular, it’s a top choice for container orchestration, meaning how teams automate deployments, scheduling, scaling, and other critical work involved in running containers. (You probably won’t see Kubernetes become a go-to platform for teaching children computing principles, though.)
At first blush, pairing these two technologies together – low-cost personal computing hardware and a powerful open source container orchestration platform – might seem unusual. But actually, the Raspberry Pi’s suitability for learning extends well beyond the classroom or home.
Raspberry Pi + Kubernetes = Easy experimentation
So how do these technologies go together? The crux of their relationship is experimentation – and in particular low-cost experimentation, which means failure is just fine as someone travels their individual learning curve and develops experience.
“Raspberry Pis can unlock a lot of knowledge and creativity around hardware, and the membrane of software to the hardware,” says Ravi Lachhman, evangelist at Harness. “Dabbling in items that could potentially roast or brick your expensive laptop can be tried on a Raspberry Pi device without worry, since they are relatively inexpensive.”
In particular, Lachhman notes that a group of Raspberry Pi devices can help someone stretch their distributed systems wings, and be used to simulate the nodes (or machines) that host containerized workloads in a Kubernetes cluster. While a tool like Minikube is also great for learning and other purposes, it runs a single-node cluster on your laptop.
[ Related read: What’s the difference between a pod, a cluster, and a container? ]
“Each Raspberry Pi is effectively its own node with its own operating system,” Lachhman says. “Because Raspberry Pis come with connectivity that allows them to cluster together, you could create a Beowulf cluster representing several nodes at your disposal. If you just had your laptop, you would have to run multiple VMs to achieve the same thing, which can tax your machine.”
Indeed, this means you can build experience with cloud computing, hybrid cloud, and Kubernetes from home (or anywhere, really.)
How to build a Kubernetes cluster with Raspberry Pi devices
As Red Hat SRE Chris Collins wrote recently over at our sibing site, Opensource.com: “Nothing says ‘cloud’ quite like Kubernetes, and nothing screams ‘cluster me!’ quite like Raspberry Pis. Running a local Kubernetes cluster on cheap Raspberry Pi hardware is a great way to gain experience managing and developing on a true cloud technology giant.”
Be sure to check out Collins’ step-by-step by guide to installing a Kubernetes cluster on three or more Raspberry Pi machines.
For the imaginative and ambitious, Lachhman notes that once you’re up-and-running, you could even start to scale your hardware by continuing to add new Raspberry Pis as additional worker nodes in your cluster.
“You might want to dedicate a node to act as a load balancer if you start to get really large clusters or network heavy workloads you are placing on your set of Raspberry Pis,” Lachhman says.
Whether you run a cluster of several or dozens of machines, though, the goal is the same: Experimentation and learning.
It’s not just about getting your hands dirty with Kubernetes (and how a cluster runs across distributed hardware), though.
“When it comes to deciding what you do with your own little supercomputer with several or several dozen Raspberry Pis, the world is your oyster,” Lachhman says.
[ Kubernetes 101: An introduction to containers, Kubernetes, and OpenShift: Watch the on-demand Kubernetes 101 webinar. ]
What can a Raspberry Pi cluster be used for? Think testing and simulation, for starters
Both Lachhman and Raghu Kishore Vempati, director of technology, research, and innovation at Altran, point to the simulation and testing possibilities of running a Kubernetes cluster on a fleet of several or more Raspberry Pis. You can test for resiliency, performance, and scalability under various conditions, for example. Lachhman likens the setup “to the art of the possible:”
“Testing workloads [when] you are unsure of scalability are great to place on your Raspberry Pi- powered Kubernetes cluster,” Lachhman says. “Does adding more replicas impact application performance?”
Similarly, if you want to field test latency, Lachhman notes that you can try running everything over your home WiFi setup instead of wired connectivity in an office. And the possibilities continue from there.
“You can answer some old compute/mathematical problems such as the Infinite Monkey Theorem, where you can generate any text with random characters/numbers,” Lachhman says. “Don’t be afraid to experiment, even pull Raspberry Pis from your cluster, to see how Kubernetes handles failure.”
Vempati concurs that the fundamental value of running Kubernetes on Raspberry Pis is the learning experience, including the infrastructure set-up (meaning, setting up your Raspberry Pi devices and installing a cluster on them.) That latter part isn’t something you necessarily get from some other learning tools.
“For practitioners who would like to get hands-on experience to experiment with the setup of Kubernetes cluster from scratch on hardware without incurring significant cost, Raspberry Pis are a viable solution,” Vempati says.
From the simulation and testing standpoint, Vempati notes there are lots of possibilities for IoT scenarios and how containerized applications could run on IoT devices.
“Kubernetes has been a proven container orchestration solution for containerized applications hosted on physical and virtualized platforms, both on-premises and cloud,” Vempati says. “It is possible to mirror the same capability on a cluster of IoT devices simulated using Raspberry Pis. An array of Raspberry Pi devices can be provisioned and Kubernetes can be installed on them to run containerized applications.”
The same principle of simulating IoT environments and testing for things like performance and latency applies here.
Vempati also notes another possible category of testing: Simulating the use of ARM processors in a datacenter.
“There is an increasing interest across the industry in having ARM processors in data centers along with the x64 processors, with a view to reduce infrastructure costs,” Vempati says. “The ‘performance-per-watt’ of ARM-based CPUs is relatively lower compared to legacy processor architectures.”
Because Kubernetes can run containerized applications anywhere, including in your own private cloud or datacenter, this offers another simulation scenario.
“Given Raspberry Pis have ARM-compatible CPUs, they can be used as a first step by users to verify scalability and performance of containerized applications on ARM based processors,” Vempati says.