Skip to content

Commit

Permalink
feat: add eviction hard to kubelet config (kubernetes-sigs#8421)
Browse files Browse the repository at this point in the history
Signed-off-by: Cyril Corbon <[email protected]>
  • Loading branch information
cyril-corbon authored and LuckySB committed Oct 20, 2023
1 parent 0eb2613 commit d8e3977
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions inventory/sample/group_vars/k8s_cluster/k8s-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@ podsecuritypolicy_enabled: false
# system_master_memory_reserved: 256Mi
# system_master_cpu_reserved: 250m

## Eviction Thresholds to avoid system OOMs
# https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/#eviction-thresholds
# eviction_hard: {}
# eviction_hard_control_plane: {}

# An alternative flexvolume plugin directory
# kubelet_flexvolumes_plugins_dir: /usr/libexec/kubernetes/kubelet-plugins/volume/exec

Expand Down
5 changes: 5 additions & 0 deletions roles/kubernetes/node/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ system_cpu_reserved: 500m
system_master_memory_reserved: 256Mi
system_master_cpu_reserved: 250m

## Eviction Thresholds to avoid system OOMs
# https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/#eviction-thresholds
eviction_hard: {}
eviction_hard_control_plane: {}

kubelet_status_update_frequency: 10s

# Limits for kube components
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ systemReserved:
memory: {{ system_memory_reserved }}
{% endif %}
{% endif %}
{% if is_kube_master|bool and eviction_hard_control_plane is defined and eviction_hard_control_plane %}
evictionHard:
{{ eviction_hard_control_plane | to_nice_yaml(indent=2) }}
{% elif not is_kube_master|bool and eviction_hard is defined and eviction_hard %}
evictionHard:
{{ eviction_hard | to_nice_yaml(indent=2) }}
{% endif %}
resolvConf: "{{ kube_resolv_conf }}"
{% if kubelet_config_extra_args %}
{{ kubelet_config_extra_args | to_nice_yaml(indent=2) }}
Expand Down

0 comments on commit d8e3977

Please sign in to comment.