SOLVED: rke2-agent-3 systemd[1]: Failed to start Rancher Kubernetes Engine v2 (agent) invalid kernel parameter

root@:/etc/rancher/rke2# sudo systemctl status rke2-agent
● rke2-agent.service - Rancher Kubernetes Engine v2 (agent)
     Loaded: loaded (/usr/local/lib/systemd/system/rke2-agent.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Wed 2023-11-29 13:37:29 CET; 1min 2s ago
       Docs: https://github.com/rancher/rke2#readme
   Main PID: 15771 (code=exited, status=1/FAILURE)
      Tasks: 0
     Memory: 0B
     CGroup: /system.slice/rke2-agent.service
             └─16124 (sh)

Nov 29 13:38:32 rke2-agent-3 systemd[1]: rke2-agent.service: Scheduled restart job, restart counter is a>
Nov 29 13:38:32 rke2-agent-3 systemd[1]: Stopped Rancher Kubernetes Engine v2 (agent).
Nov 29 13:38:32 rke2-agent-3 systemd[1]: Starting Rancher Kubernetes Engine v2 (agent)...
Nov 29 13:38:32 rke2-agent-3 sh[16124]: + /usr/bin/systemctl is-enabled --quiet nm-cloud-setup.service
systemctl status rke2-agent.service
● rke2-agent.service - Rancher Kubernetes Engine v2 (agent)
     Loaded: loaded (/usr/local/lib/systemd/system/rke2-agent.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Wed 2023-11-29 13:39:38 CET; 1s ago
       Docs: https://github.com/rancher/rke2#readme
    Process: 27141 ExecStartPre=/bin/sh -xc ! /usr/bin/systemctl is-enabled --quiet nm-cloud-setup.servi>
    Process: 27150 ExecStartPre=/sbin/modprobe br_netfilter (code=exited, status=0/SUCCESS)
    Process: 27161 ExecStartPre=/sbin/modprobe overlay (code=exited, status=0/SUCCESS)
    Process: 27175 ExecStart=/usr/local/bin/rke2 agent (code=exited, status=1/FAILURE)
    Process: 27301 ExecStopPost=/bin/sh -c systemd-cgls /system.slice/rke2-agent.service | grep -Eo '[0->
   Main PID: 27175 (code=exited, status=1/FAILURE)
/usr/local/bin/rke2 agent
FATA[0000] invalid kernel parameter value kernel.panic_on_oops=0 - expected 1
invalid kernel parameter value vm.overcommit_memory=0 - expected 1
invalid kernel parameter value kernel.panic=0 - expected 10

FIX

cat > /etc/sysctl.d/90-kubelet.conf << EOF
vm.overcommit_memory=1
kernel.panic=10
kernel.panic_on_oops=1
EOF
sysctl -p /etc/sysctl.d/90-kubelet.conf
sudo systemctl restart rke2-agent
kubelet fails to start when set --protect-kernel-defaults=true. · Issue #66241 · kubernetes/kubernetes
Is this a BUG REPORT or FEATURE REQUEST?: Uncomment only one, leave it on its own line: /kind bug What happened: Set --protect-kernel-defaults=true in kubelet.service, reload & restart kubelet.serv…