k3s-agent.service.j2 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. [Unit]
  2. Description=Lightweight Kubernetes
  3. Documentation=https://k3s.io
  4. Wants=network-online.target
  5. After=network-online.target
  6. [Install]
  7. WantedBy=multi-user.target
  8. [Service]
  9. Type=notify
  10. EnvironmentFile=-/etc/default/%N
  11. EnvironmentFile=-/etc/sysconfig/%N
  12. EnvironmentFile=-/etc/systemd/system/k3s-agent.service.env
  13. KillMode=process
  14. Delegate=yes
  15. # Having non-zero Limit*s causes performance problems due to accounting overhead
  16. # in the kernel. We recommend using cgroups to do container-local accounting.
  17. LimitNOFILE=1048576
  18. LimitNPROC=infinity
  19. LimitCORE=infinity
  20. TasksMax=infinity
  21. TimeoutStartSec=0
  22. Restart=always
  23. RestartSec=5s
  24. ExecStartPre=/bin/sh -xc '! /usr/bin/systemctl is-enabled --quiet nm-cloud-setup.service'
  25. ExecStartPre=-/sbin/modprobe br_netfilter
  26. ExecStartPre=-/sbin/modprobe overlay
  27. {% if ip_type == 'ipv6' and api_endpoint | regex_search(':') %}
  28. ExecStart=/usr/local/bin/k3s agent --data-dir {{ k3s_server_location }} --server https://[{{ api_endpoint }}]:{{ api_port }} --token {{ token }} {{ extra_agent_args | default('') }}
  29. {% else %}
  30. ExecStart=/usr/local/bin/k3s agent --data-dir {{ k3s_server_location }} --server https://{{ api_endpoint }}:{{ api_port }} --token {{ token }} {{ extra_agent_args | default('') }}
  31. {% endif %}