feat: add k3s kubelet args and enable graceful shutdown
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Robert Kaussow 2022-11-12 16:20:08 +01:00
parent f348bbb996
commit 65f73c3e0c
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
4 changed files with 23 additions and 1 deletions

View File

@ -48,6 +48,15 @@
mode: 0600
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
template:
src: "etc/rancher/k3s/server/{{ item }}.j2"

View File

@ -0,0 +1,2 @@
#jinja2: lstrip_blocks: True
- config={{ __k3s_config_dir }}/kubelet.yaml

View File

@ -1,8 +1,13 @@
#jinja2: lstrip_blocks: True
---
{% 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 }}"
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 %}
bind-address: "{{ k3s_server_bind_ip }}"
@ -13,7 +18,7 @@ disable:
- traefik
{% if __k3s_kube_apiserver_arg is iterable %}
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 %}
{% if not k3s_server_flannel_backend_enabled | bool %}
flannel-backend: "none"

View File

@ -0,0 +1,6 @@
#jinja2: lstrip_blocks: True
---
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
shutdownGracePeriod: 30s
shutdownGracePeriodCriticalPods: 10s