feat: add k3s kubelet args and enable graceful shutdown
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
f348bbb996
commit
65f73c3e0c
@ -48,6 +48,15 @@
|
|||||||
mode: 0600
|
mode: 0600
|
||||||
notify: __k3s_restart
|
notify: __k3s_restart
|
||||||
|
|
||||||
|
- name: Copy K3s kubelet config file
|
||||||
|
template:
|
||||||
|
src: "etc/rancher/k3s/kubelet.yaml.j2"
|
||||||
|
dest: "{{ __k3s_config_dir }}/kubelet.yaml"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0600
|
||||||
|
notify: __k3s_restart
|
||||||
|
|
||||||
- name: Copy K3s server config files
|
- name: Copy K3s server config files
|
||||||
template:
|
template:
|
||||||
src: "etc/rancher/k3s/server/{{ item }}.j2"
|
src: "etc/rancher/k3s/server/{{ item }}.j2"
|
||||||
|
2
templates/_internal/kubelet-arg.yaml.j2
Normal file
2
templates/_internal/kubelet-arg.yaml.j2
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#jinja2: lstrip_blocks: True
|
||||||
|
- config={{ __k3s_config_dir }}/kubelet.yaml
|
@ -1,8 +1,13 @@
|
|||||||
#jinja2: lstrip_blocks: True
|
#jinja2: lstrip_blocks: True
|
||||||
---
|
---
|
||||||
{% set __k3s_kube_apiserver_arg = lookup('template', '_internal/apiserver-arg.yaml.j2') | from_yaml %}
|
{% set __k3s_kube_apiserver_arg = lookup('template', '_internal/apiserver-arg.yaml.j2') | from_yaml %}
|
||||||
|
{% set __k3s_kubelet_arg = lookup('template', '_internal/kubelet-arg.yaml.j2') | from_yaml %}
|
||||||
token: "{{ k3s_token }}"
|
token: "{{ k3s_token }}"
|
||||||
node-ip: "{{ k3s_node_ip }}"
|
node-ip: "{{ k3s_node_ip }}"
|
||||||
|
{% if __k3s_kubelet_arg is iterable %}
|
||||||
|
kubelet-arg:
|
||||||
|
{{ __k3s_kubelet_arg | to_nice_yaml(indent=2) | indent(2, False) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if k3s_server | bool %}
|
{% if k3s_server | bool %}
|
||||||
bind-address: "{{ k3s_server_bind_ip }}"
|
bind-address: "{{ k3s_server_bind_ip }}"
|
||||||
@ -13,7 +18,7 @@ disable:
|
|||||||
- traefik
|
- traefik
|
||||||
{% if __k3s_kube_apiserver_arg is iterable %}
|
{% if __k3s_kube_apiserver_arg is iterable %}
|
||||||
kube-apiserver-arg:
|
kube-apiserver-arg:
|
||||||
{{ __k3s_kube_apiserver_arg | to_nice_yaml(indent=2) | indent(2, False) }}
|
{{ __k3s_kube_apiserver_arg | to_nice_yaml(indent=2) | indent(2, False) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if not k3s_server_flannel_backend_enabled | bool %}
|
{% if not k3s_server_flannel_backend_enabled | bool %}
|
||||||
flannel-backend: "none"
|
flannel-backend: "none"
|
||||||
|
6
templates/etc/rancher/k3s/kubelet.yaml.j2
Normal file
6
templates/etc/rancher/k3s/kubelet.yaml.j2
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#jinja2: lstrip_blocks: True
|
||||||
|
---
|
||||||
|
apiVersion: kubelet.config.k8s.io/v1beta1
|
||||||
|
kind: KubeletConfiguration
|
||||||
|
shutdownGracePeriod: 30s
|
||||||
|
shutdownGracePeriodCriticalPods: 10s
|
Loading…
Reference in New Issue
Block a user