2019-03-09 21:54:44 +01:00
|
|
|
[Unit]
|
|
|
|
Description=Lightweight Kubernetes
|
|
|
|
Documentation=https://k3s.io
|
2020-09-21 20:38:51 +02:00
|
|
|
Wants=network-online.target
|
|
|
|
After=network-online.target
|
2019-03-09 21:54:44 +01:00
|
|
|
|
|
|
|
[Service]
|
2019-10-01 22:31:35 +02:00
|
|
|
Type={{ 'notify' if k3s_control_node else 'exec' }}
|
2019-03-09 21:54:44 +01:00
|
|
|
ExecStartPre=-/sbin/modprobe br_netfilter
|
|
|
|
ExecStartPre=-/sbin/modprobe overlay
|
2019-11-03 16:35:32 +01:00
|
|
|
{% filter regex_replace('\s+', ' ') %}
|
2019-10-26 23:49:48 +02:00
|
|
|
{% filter replace('\n', ' ') %}
|
|
|
|
ExecStart={{ k3s_install_dir }}/k3s
|
2020-09-21 19:44:11 +02:00
|
|
|
{% if k3s_debug is defined and k3s_debug %}
|
|
|
|
--debug
|
|
|
|
{% endif %}
|
2019-03-09 21:54:44 +01:00
|
|
|
{% if k3s_control_node %}
|
2020-09-15 19:10:25 +02:00
|
|
|
server
|
2020-10-19 21:26:12 +02:00
|
|
|
{% if k3s_server is defined %}
|
|
|
|
--config {{ k3s_config_file }}
|
2020-07-04 14:24:10 +02:00
|
|
|
{% endif %}
|
2019-03-09 21:54:44 +01:00
|
|
|
{% else %}
|
2019-10-26 23:49:48 +02:00
|
|
|
agent
|
2020-10-19 21:26:12 +02:00
|
|
|
--server https://{{ k3s_control_node_address }}:{{ k3s_server['https-listen-port'] | default(6443) }}
|
2020-09-21 20:38:51 +02:00
|
|
|
--token-file {{ k3s_token_location }}/cluster-token
|
2020-10-19 21:26:12 +02:00
|
|
|
{% if k3s_agent is defined %}
|
|
|
|
--config {{ k3s_config_file }}
|
2020-09-24 16:21:48 +02:00
|
|
|
{% endif %}
|
2019-12-21 18:11:30 +01:00
|
|
|
{% endif %}
|
2019-10-26 23:49:48 +02:00
|
|
|
{% endfilter %}
|
2019-11-03 16:35:32 +01:00
|
|
|
{% endfilter %}
|
2019-10-26 23:49:48 +02:00
|
|
|
|
2019-03-09 21:54:44 +01:00
|
|
|
KillMode=process
|
|
|
|
Delegate=yes
|
2020-09-21 14:39:55 +02:00
|
|
|
LimitNOFILE=1048576
|
2019-03-09 21:54:44 +01:00
|
|
|
LimitNPROC=infinity
|
|
|
|
LimitCORE=infinity
|
|
|
|
TasksMax=infinity
|
2019-10-01 22:31:35 +02:00
|
|
|
TimeoutStartSec=0
|
|
|
|
Restart=always
|
|
|
|
RestartSec=5s
|
2019-03-09 21:54:44 +01:00
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|