Skip to content

Commit

Permalink
Support k3s-agent deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
jvassev committed May 13, 2024
1 parent cf5355d commit aa3678c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions k8s/scripts/kubelet-config-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1480,6 +1480,30 @@ function do_config_kubelet() {
fi
}

###############################################################################
# Scenario 6: k3s worker
###############################################################################
function kubelet_k3s_deploymet() {
if systemctl is-active --quiet k3s-agent; then
return
fi

return 1
}

function do_config_kubelet_k3s_systemd() {
local unit_file="/etc/systemd/system/k3s-agent.service"

if grep -q 'container-runtime-endpoint=/var/run/crio/crio.sock' $unit_file; then
echo "k3s-agent.service already modified"
return
fi

sed "s| agent | agent --kubelet-arg=--cgroup-driver=systemd --container-runtime-endpoint=/var/run/crio/crio.sock |" -i $unit_file
systemctl daemon-reload
systemctl restart k3s-agent
}

function main() {

euid=$(id -u)
Expand Down Expand Up @@ -1509,6 +1533,8 @@ function main() {
do_config_kubelet_rke2
elif kubelet_docker_systemd_deployment; then
do_config_kubelet_docker_systemd
elif kubelet_k3s_deploymet; then
do_config_kubelet_k3s_systemd
else
do_config_kubelet
fi
Expand Down

0 comments on commit aa3678c

Please sign in to comment.