Set User in k3s systemd unit

This ensures that the $HOME and $USER env vars get set. We have worked around this on the RKE2 side by setting it manually in the default .env file:
https://github.com/rancher/rke2/blob/master/bundle/lib/systemd/system/rke2-server.env

This is required for loading credentials from shared credentials files (`/root/.aws/credentials`)

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
Brad Davidson 2025-02-12 22:38:47 +00:00 committed by Brad Davidson
parent 8aa543eb87
commit 864ed2a4f1
2 changed files with 2 additions and 1 deletions

View file

@ -993,6 +993,7 @@ EnvironmentFile=-/etc/sysconfig/%N
EnvironmentFile=-${FILE_K3S_ENV}
KillMode=process
Delegate=yes
User=root
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=1048576

View file

@ -1 +1 @@
527dc64257a261b83042eb550f24648d2664656e8aef3d4633ac2a746848c6ae install.sh
9d5fc42bf825d3e8dcc8682c8bac071b1de18019af81f85519ccbe5c919e0896 install.sh