Deploying Masterless Salt on the Raspberry Pi
• Mark Eschbach
When I got my Raspberry Pi 4 for my k8s cluster I did the bare minimum to set up the node. I was not quiet sure what I would need to do in order to get Kubernetes running. However, errors have begun to pop up as a result. Time to bring the node under my Salt configuration. Probably time I learn a bit more about Salt too.
First up is figuring out how to differentiate a Raspberry Pi 3 from a Raspberry Pi 4 in Salt. I was thinking Pillars would be the appropriate approach. According to a draft of the book Salt Cookbook it appears like Pillars are the incorrect choice.
It appears like Grains are the correct choice. Somewhere along the lines the salt installation on my primary workstation became broken…bummer.
Traceback (most recent call last):
File "/usr/local/bin/salt", line 6, in <module>
from salt.scripts import salt_main
ModuleNotFoundError: No module named 'salt'
At some point I guess I uninstalled Salt. Ideally I find a replacement in the future however for now I will reinstall it.
A simple local inspection with sudo salt-call --local grains.items
produced a copious amount of output. Running
sudo apt-get install salt-minion
and editing /etc/salt/minion
to add the file_client: local
setting. For good
measure I stopped the minion
service via sudo systemctl stop salt-minion && sudo systemctl disable salt-minion
.
Double-checking sudo salt-call --local grains.item cpuarch
gives the expected value arm7l
.
Turns out one can easily select the union of an OS and architecture type via the following:
base:
'*':
- common
'G@os:Raspbian and G@cpuarch:armv7l':
- match: compound
- modules/raspbian-arm7l/raspbian
On the target node you can simply run the following to test to ensure the results are mostly what you would expect:
salt-call --local state.highstate --state-output=changes test=True
.