Hands-on with the Turing Pi 2!

The Turing Pi 2 is quite an exciting project that might even be a game-changer when it comes to homelab. With it, you can set up Raspberry Pi Compute Modules as individual servers, and even cluster them! The Turing Pi 2 gives you access to many additional features that Compute Modules wouldn’t normally have access to, such as mPCIe, SATA, and more. This gives you access to build a data-center in a box, and Jay gives it a first-look on the channel in this video.

Subscribe to LearnLinuxTV

Relevant links

Check out the Turing Pi 2

Commands and Code used in the video

Kubernetes Cluster setup with K3s

On each Pi in the cluster, do the following:

Install all available updates:
sudo apt update && sudo apt dist-upgrade
Edit boot parameters
sudo nano /boot/cmdline.txt

Add the following to the end of the first line (don’t create a new line):

cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory
Reboot each compute module

To enable the options that you set in the cmdline.txt file, and also because important packages were updated, reboot each compute module:

sudo reboot

On the compute module dedicated as the controller, do the following:


Install K3s:
curl -sfL https://get.k3s.io | sh -

Note: No need to use sudo, it should elevate privileges accordingly.

Check that K3s is running:
systemctl status k3s
Get the node token (store it somewhere safe):
sudo cat /var/lib/rancher/k3s/server/node-token
List available nodes
sudo kubectl get nodes

Note: no nodes should show yet, since we haven’t added any.

Adding a node to the cluster
sudo curl -sfL https://get.k3s.io | K3S_TOKEN="TOKEN_GOES_HERE" K3S_URL="https://172.16.249.213:6443" K3S_NODE_NAME="cm4-3" sh -

Note: Make sure you change the token, IP address, and node name according to what’s required for your cluster. The token was obtained from the node-token file earlier.

Check nodes:
sudo kubectl get nodes

It might take a few minutes, but the new node should show up in the list. Feel free to add additional nodes as you wish.

Applying a yaml file

There are two yaml files shown below. Save them both onto your controller node. Apply them with the following commands:

booksonic_pod.yml
sudo kubectl apply -f booksonic_pod.yml
booksonic_service.yml
sudo kubectl apply -f booksonic_service.yml
Checking pods and services

After applying the yaml files, you can check that they’ve been accepted with the following commands.

Check pods
sudo kubectl get pods
Check services
kubectl get service

Accessing the app

After creating the pod and the service, you should be able to access the app that’s running in your container.

http://<hostname or IP address>:32040

Config files used in the video

booksonic_pod.yml

apiVersion: v1
kind: Pod
metadata:
  name: booksonic
  labels:
    app: booksonic
spec:
  containers:
    - name: booksonic
      image: linuxserver/booksonic
      ports:
        - containerPort: 4040
          name: "booksonic-http"

booksonic_service.yml

apiVersion: v1
kind: Service
metadata:
  name: booksonic
spec:
  type: NodePort
  ports:
    - name: http
      port: 4040
      nodePort: 32040
      targetPort: booksonic-http
  selector:
    app: booksonic