Scott Hanselman and Alex Ellis build a Raspberry Pi cluster with Kubernetes, OpenFaaS and .NET. But why would you do this? And what is Kubernetes anyway? Find out everything you needed to know and more in this presentation.
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Building a Raspberry Pi cluster with Kubernetes, OpenFaaS and .NET
1. Building a Raspberry Pi
Kubernetes Cluster
and Running .NET Core
with OpenFaaS
Alex Ellis @alexellisuk
Scott Hanselman @shanselman
2. Agenda
Why build an RPi cluster?
What counts as Cloud?
Top community clusters
Practicalities of ARM & .NET Core
Intro to Kubernetes & Serverless
Demos
11. Alex’s first RPi
cluster
Featured in Linux User Developer
Magazine
Had to build Docker from source
Original “Swarm” project from
Docker
29 MARCH 2016
29. No:
Accelerated gaming
Bitcoin mining
Windows binaries
Skynet
What can I do with my Pi (ARM) cluster?
Yes:
You can run server software
Python MPI (traditional
multi-processing)
A blog or website, i.e. ASP.NET,
Node.js, PHP etc
30.
31.
32.
33. OpenFaaS - Serverless Functions Made Simple
● Community project
● Developer-first experience
○ UI & CLI
● 9k GitHub stars
● Award winning
● Thriving community
● Easiest way to run your own
FaaS or functions
35. Want to know more?
blog.alexellis.io -
launched 2015
Around 100 blog posts on
Docker, Kubernetes, ARM
and IoT
Coding in Go, community
and DevOps
36. What about the software?
Pick an OS
● Raspbian (Debian-based)
● Hypriot (Raspbian-based)
● Ubuntu (Debian-based)
Something completely different:
Resin
Configure each node manually
Or automate with Ansible
But avoid duplicating SD cards
Be aware not all Docker images
support ARM
38. .NET Core
Best option for modern microservices in C#, ASP.NET also available
Natively targets: Linux, Windows and Mac
Runtime support for ARM (Raspberry Pi)
Official Docker images are available from Microsoft
...
.NET Core + Kubernetes
39. Multi-Arch Cross
Compilation
Build in a container
Publish to specific
CPU Arch
Use correct runtime
FROM microsoft/dotnet:2.0-sdk as builder
RUN mkdir -p /root/src/function
WORKDIR /root/src/function
COPY ./function/Function.csproj .
WORKDIR /root/src/
COPY ./root.csproj .
RUN dotnet restore ./root.csproj
COPY . .
RUN dotnet publish -c release -o published -r linux-arm
ADD https://github.com/openfaas/faas/releases/download/0.6.1/fwatchdog-armhf
/usr/bin/fwatchdog
RUN chmod +x /usr/bin/fwatchdog
FROM microsoft/dotnet:2.0.0-runtime-stretch-arm32v7
WORKDIR /root/
COPY --from=builder /root/src/published .
COPY --from=builder /usr/bin/fwatchdog /
ENV fprocess="dotnet ./root.dll"
EXPOSE 8080
CMD ["/fwatchdog"]
40. RPi Cluster Build Consideration
● Raspberry Pis like 3A+ Reliable Power
○ Anker makes a 6 port USB Charger. One plug powers the
whole cluster!
○ Get a Raspberry Pi multi-layer case enclosure
○ Or build one with LEGO!
● Use flat and short Ethernet Cables. Wired >Wireless
○ Get cables of varied length. Use the minimum
41. Networking Challenges
● Wired networking is best.
● BlackBox makes a nice 8-port
USB-Powered Hub
○ Any one of the Pis can power the Hub itself!
○ Hub sits on top of the Pi stack with magnets
● Hardest part: For portability, get a router.
○ Ideally the cluster will have either static IPs or
reliable DHCP leases