2019-03-09 21:54:44 +01:00
[Unit]
Description=Lightweight Kubernetes
Documentation=https://k3s.io
After=network.target
[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
{% if k3s_control_node %}
2019-09-29 19:03:50 +02:00
ExecStart={{ k3s_install_dir }}/k3s server{{ ' --disable-agent' if not k3s_control_workers else '' }}{{ ' --flannel-iface ' + k3s_flannel_interface if k3s_flannel_interface is defined and not k3s_no_flannel else '' }}{{ ' --no-flannel' if k3s_no_flannel else '' }}{{ ' --docker' if k3s_ensure_docker_installed else '' }}
2019-03-09 21:54:44 +01:00
{% else %}
2019-09-29 19:03:50 +02:00
ExecStart={{ k3s_install_dir }}/k3s agent{{ ' --docker' if k3s_ensure_docker_installed else '' }}{{ ' --flannel-iface ' + k3s_flannel_interface if k3s_flannel_interface is defined and not k3s_no_flannel else '' }}{{ ' --no-flannel' if k3s_no_flannel else '' }} --server https://{{ k3s_control_node_address }}:6443 --token {{ k3s_control_token.content | b64decode }}
2019-03-09 21:54:44 +01:00
{% endif %}
KillMode=process
Delegate=yes
LimitNOFILE=infinity
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