Skip to content

Commit

Permalink
Add k3s services
Browse files Browse the repository at this point in the history
  • Loading branch information
valtzu committed Sep 15, 2024
1 parent e9fcf85 commit 12d1f10
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mkosi.extra/usr/lib/systemd/system-preset/00-mkosi.preset
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
enable sshd-keygen.service

# systemd-repart already runs in initrd, no reason to re-run it after switching to rootfs
disable systemd-repart.service
# Make sure k3s is not enabled by default
disable k3s.service
disable k3s-agent.service
27 changes: 27 additions & 0 deletions mkosi.extra/usr/lib/systemd/system/k3s-agent.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[Unit]
Description=K3s agent
Documentation=https://k3s.io
Wants=network-online.target
After=network-online.target

[Install]
WantedBy=multi-user.target

[Service]
Type=notify
EnvironmentFile=-/etc/systemd/system/%n.env
KillMode=process
Delegate=yes
# 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
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
TimeoutStartSec=0
Restart=always
RestartSec=5s
ExecStartPre=/bin/sh -xc '! /usr/bin/systemctl is-enabled --quiet nm-cloud-setup.service'
ExecStartPre=-/sbin/modprobe br_netfilter
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/bin/k3s agent
27 changes: 27 additions & 0 deletions mkosi.extra/usr/lib/systemd/system/k3s.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[Unit]
Description=K3s server
Documentation=https://k3s.io
Wants=network-online.target
After=network-online.target

[Install]
WantedBy=multi-user.target

[Service]
Type=notify
EnvironmentFile=-/etc/systemd/system/%n.env
KillMode=process
Delegate=yes
# 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
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
TimeoutStartSec=0
Restart=always
RestartSec=5s
ExecStartPre=/bin/sh -xc '! /usr/bin/systemctl is-enabled --quiet nm-cloud-setup.service'
ExecStartPre=-/sbin/modprobe br_netfilter
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/bin/k3s server

0 comments on commit 12d1f10

Please sign in to comment.