Add more configuration to enable swap

This commit is contained in:
Adrien Reslinger 2024-12-01 11:30:24 +01:00
parent 714868ab71
commit c58515cbce
Signed by: adrien
GPG key ID: DA7B27055C66D6DE
4 changed files with 21 additions and 0 deletions

View file

@ -172,6 +172,20 @@
- ansible_service_mgr == "systemd" - ansible_service_mgr == "systemd"
- kubernetes_cri == "cri-o" - kubernetes_cri == "cri-o"
- name: Enable Swap for kubelet service
ansible.builtin.template:
src: "etc/{{ item }}.j2"
dest: "/etc/{{ item }}"
group: root
owner: root
mode: 0644
with_items:
- "systemd/system/kubelet.service.d/20-allow-swap.conf"
when:
- ansible_service_mgr == "systemd"
- kubernetes_swap_enabled is defined
- kubernetes_swap_enabled|bool
- name: Configure kubelet service - name: Configure kubelet service
ansible.builtin.template: ansible.builtin.template:
src: "etc/{{ item }}.j2" src: "etc/{{ item }}.j2"

View file

@ -34,6 +34,9 @@ token: ${NODE_TOKEN}
kubelet-arg: kubelet-arg:
- 'streaming-connection-idle-timeout=5m' - 'streaming-connection-idle-timeout=5m'
- "tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305" - "tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305"
{% if false %}
- 'feature-gates=NodeSwap=true,CloudDualStackNodeIPs=true'
{% endif %}
{% if ansible_os_family == "RedHat" %} {% if ansible_os_family == "RedHat" %}
selinux: true selinux: true
{% endif %} {% endif %}

View file

@ -0,0 +1 @@
[Service] Environment="KUBELET_EXTRA_ARGS=--fail-swap-on=false"

View file

@ -126,6 +126,9 @@ nodeRegistration:
# read-only-port: "10255" # read-only-port: "10255"
ignorePreflightErrors: ignorePreflightErrors:
- SystemVerification - SystemVerification
{% if kubernetes_swap_enabled is defined and kubernetes_swap_enabled|bool %}
- Swap
{% endif %}
{% if (kubernetes_master|bool and not kubernetes_master_taint|bool) %} {% if (kubernetes_master|bool and not kubernetes_master_taint|bool) %}
- NumCPU - NumCPU
{% endif %} {% endif %}