I needed a way of creating a system service to automagically start a k3s agent
when the node booted up.
- Create a
.service
file and a.py
file for the python script with the following content.
startk3sagent.service
1 | sudo nano startk3sagent.service |
1 | [Unit] |
startk3sagent.py
1 | mkdir k3sscripts |
1 | import os |
- Copy the file and test it works
1 | sudo cp startk3sagent.service /etc/systemd/system/startk3sagent.service ~ copy file |
- Install as a service
1 | sudo systemctl enable startk3sagent.service |
- Check what services are running
1 | sudo service --status-all |