feat: replace stale-containers systemd timer with kubelet-args
Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
7 files changed
+8
-63
No files matched your search
@@ -41,3 +41,7 @@ k3s_server:
|
|||||||
- "bind-address=0.0.0.0" # Required to monitor kube-scheduler with kube-prometheus-stack
|
- "bind-address=0.0.0.0" # Required to monitor kube-scheduler with kube-prometheus-stack
|
||||||
kube-apiserver-arg:
|
kube-apiserver-arg:
|
||||||
- "anonymous-auth=true" # Required for HAProxy health-checks
|
- "anonymous-auth=true" # Required for HAProxy health-checks
|
||||||
|
# TODO: Move these options to a kubelet config file
|
||||||
|
kubelet-arg:
|
||||||
|
- "image-gc-high-threshold=55"
|
||||||
|
- "image-gc-low-threshold=50"
|
||||||
@@ -11,3 +11,7 @@ k3s_agent:
|
|||||||
node-ip: "{% raw %}{{ ansible_host }}{% endraw %}"
|
node-ip: "{% raw %}{{ ansible_host }}{% endraw %}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
pause-image: registry.k8s.io/pause:3.9
|
pause-image: registry.k8s.io/pause:3.9
|
||||||
|
# TODO: Move these options to a kubelet config file
|
||||||
|
kubelet-arg:
|
||||||
|
- "image-gc-high-threshold=55"
|
||||||
|
- "image-gc-low-threshold=50"
|
||||||
@@ -68,8 +68,3 @@
|
|||||||
- name: Cruft
|
- name: Cruft
|
||||||
when: k3s_primary_control_node
|
when: k3s_primary_control_node
|
||||||
ansible.builtin.include_tasks: tasks/cruft.yaml
|
ansible.builtin.include_tasks: tasks/cruft.yaml
|
||||||
|
|
||||||
- name: Stale Containers
|
|
||||||
ansible.builtin.include_tasks: tasks/stale_containers.yaml
|
|
||||||
vars:
|
|
||||||
stale_containers_state: enabled
|
|
||||||
@@ -90,11 +90,6 @@
|
|||||||
state: absent
|
state: absent
|
||||||
loop: ["kubectl", "crictl", "ctr"]
|
loop: ["kubectl", "crictl", "ctr"]
|
||||||
|
|
||||||
- name: Stale Containers
|
|
||||||
ansible.builtin.include_tasks: tasks/stale_containers.yaml
|
|
||||||
vars:
|
|
||||||
stale_containers_state: disabled
|
|
||||||
|
|
||||||
- name: Reboot
|
- name: Reboot
|
||||||
ansible.builtin.reboot:
|
ansible.builtin.reboot:
|
||||||
msg: Rebooting nodes
|
msg: Rebooting nodes
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Stale containers
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=/usr/local/bin/k3s crictl rmi --prune
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Stale containers
|
|
||||||
|
|
||||||
[Timer]
|
|
||||||
OnCalendar=weekly
|
|
||||||
AccuracySec=1h
|
|
||||||
Persistent=true
|
|
||||||
RandomizedDelaySec=6000
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=timers.target
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
---
|
|
||||||
# https://github.com/k3s-io/k3s/issues/1900
|
|
||||||
- name: Enabled Stale containers
|
|
||||||
when: stale_containers_state == "enabled"
|
|
||||||
block:
|
|
||||||
- name: Stale containers | Create systemd unit
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: files/stale-containers.service
|
|
||||||
dest: /etc/systemd/system/stale-containers.service
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: "0644"
|
|
||||||
|
|
||||||
- name: Stale containers | Create systemd timer
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: files/stale-containers.timer
|
|
||||||
dest: /etc/systemd/system/stale-containers.timer
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: "0644"
|
|
||||||
|
|
||||||
- name: Stale containers | Start the systemd timer
|
|
||||||
ansible.builtin.systemd:
|
|
||||||
name: stale-containers.timer
|
|
||||||
enabled: true
|
|
||||||
daemon_reload: true
|
|
||||||
masked: false
|
|
||||||
state: started
|
|
||||||
|
|
||||||
- name: Disable Stale containers
|
|
||||||
when: stale_containers_state == "disabled"
|
|
||||||
block:
|
|
||||||
- name: Stale containers | Mask the systemd timer
|
|
||||||
ansible.builtin.systemd:
|
|
||||||
name: stale-containers.timer
|
|
||||||
masked: true
|
|
||||||
Reference in new issue
Block a user