33 lines
1.2 KiB
YAML
33 lines
1.2 KiB
YAML
- name: Kubelet image garbage collection
|
|
tags: kubelet_gc
|
|
block:
|
|
- name: Create the kubelet drop-in directory
|
|
file:
|
|
path: /etc/rancher/k3s/kubelet.conf.d
|
|
state: directory
|
|
mode: "0755"
|
|
|
|
- name: Set the image garbage collection thresholds
|
|
copy:
|
|
dest: /etc/rancher/k3s/kubelet.conf.d/10-image-gc.conf
|
|
mode: "0644"
|
|
content: |
|
|
apiVersion: kubelet.config.k8s.io/v1beta1
|
|
kind: KubeletConfiguration
|
|
imageGCHighThresholdPercent: 70
|
|
imageGCLowThresholdPercent: 55
|
|
imageMaximumGCAge: 168h
|
|
|
|
# Every pod watching its config files takes inotify instances and watches from
|
|
# the per-user pool. An LXC container inherits these from its host. Only this
|
|
# file is loaded: sysctl --system would also apply distribution defaults such as
|
|
# rp_filter that differ from the live values Cilium relies on.
|
|
- name: Raise the inotify limits
|
|
tags: inotify
|
|
when: ansible_facts['virtualization_type'] != 'lxc'
|
|
ansible.posix.sysctl:
|
|
name: "{{ item.key }}"
|
|
value: "{{ item.value }}"
|
|
sysctl_file: /etc/sysctl.d/90-inotify.conf
|
|
loop: "{{ {'fs.inotify.max_user_instances': 65536, 'fs.inotify.max_user_watches': 4194304} | dict2items }}"
|