Put the file in /etc/systemd/system/shutdown-k3s.service and then enable the service using
systemctl enable shutdown-k3s.service
Also note that this service name shutdown-k3s must not start with k3s-, otherwise the k3s-killall.sh script would also try to stop this service and cause problems.
- Copied from this github issue k3s-io/k3s#2400 (comment)