Browse Source

support reserve ephemeral-storage (#8895)

pull/8937/head
Thearas 2 years ago
committed by GitHub
parent
commit
01ca7293f5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 1 deletions
  1. 1
      .gitignore
  2. 2
      inventory/sample/group_vars/k8s_cluster/k8s-cluster.yml
  3. 4
      roles/kubernetes/node/defaults/main.yml
  4. 14
      roles/kubernetes/node/templates/kubelet-config.v1beta1.yaml.j2

1
.gitignore

@ -4,6 +4,7 @@
*.iml
temp
.idea
.vscode
.tox
.cache
*.bak

2
inventory/sample/group_vars/k8s_cluster/k8s-cluster.yml

@ -252,9 +252,11 @@ podsecuritypolicy_enabled: false
## Uncomment to override default values
# system_memory_reserved: 512Mi
# system_cpu_reserved: 500m
# system_ephemeral_storage_reserved: 2Gi
## Reservation for master hosts
# system_master_memory_reserved: 256Mi
# system_master_cpu_reserved: 250m
# system_master_ephemeral_storage_reserved: 2Gi
## Eviction Thresholds to avoid system OOMs
# https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/#eviction-thresholds

4
roles/kubernetes/node/defaults/main.yml

@ -28,17 +28,21 @@ kubelet_fail_swap_on: true
# Reserve this space for kube resources
kube_memory_reserved: 256Mi
kube_cpu_reserved: 100m
# kube_ephemeral_storage_reserved: 2Gi
# Reservation for master hosts
kube_master_memory_reserved: 512Mi
kube_master_cpu_reserved: 200m
# kube_master_ephemeral_storage_reserved: 2Gi
# Set to true to reserve resources for system daemons
system_reserved: false
system_memory_reserved: 512Mi
system_cpu_reserved: 500m
# system_ephemeral_storage_reserved: 2Gi
# Reservation for master hosts
system_master_memory_reserved: 256Mi
system_master_cpu_reserved: 250m
# system_master_ephemeral_storage_reserved: 2Gi
## Eviction Thresholds to avoid system OOMs
# https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/#eviction-thresholds

14
roles/kubernetes/node/templates/kubelet-config.v1beta1.yaml.j2

@ -23,7 +23,7 @@ enforceNodeAllocatable:
{% endfor %}
{% endif %}
staticPodPath: {{ kube_manifest_dir }}
cgroupDriver: {{ kubelet_cgroup_driver }}
cgroupDriver: {{ kubelet_cgroup_driver | default('systemd') }}
containerLogMaxFiles: {{ kubelet_logfiles_max_nr }}
containerLogMaxSize: {{ kubelet_logfiles_max_size }}
maxPods: {{ kubelet_max_pods }}
@ -63,18 +63,30 @@ kubeReserved:
{% if is_kube_master|bool %}
cpu: {{ kube_master_cpu_reserved }}
memory: {{ kube_master_memory_reserved }}
{% if kube_master_ephemeral_storage_reserved is defined %}
ephemeral-storage: {{ kube_master_ephemeral_storage_reserved }}
{% endif %}
{% else %}
cpu: {{ kube_cpu_reserved }}
memory: {{ kube_memory_reserved }}
{% if kube_ephemeral_storage_reserved is defined %}
ephemeral-storage: {{ kube_ephemeral_storage_reserved }}
{% endif %}
{% endif %}
{% if system_reserved is defined and system_reserved %}
systemReserved:
{% if is_kube_master|bool %}
cpu: {{ system_master_cpu_reserved }}
memory: {{ system_master_memory_reserved }}
{% if system_master_ephemeral_storage_reserved is defined %}
ephemeral-storage: {{ system_master_ephemeral_storage_reserved }}
{% endif %}
{% else %}
cpu: {{ system_cpu_reserved }}
memory: {{ system_memory_reserved }}
{% if system_ephemeral_storage_reserved is defined %}
ephemeral-storage: {{ system_ephemeral_storage_reserved }}
{% endif %}
{% endif %}
{% endif %}
{% if is_kube_master|bool and eviction_hard_control_plane is defined and eviction_hard_control_plane %}

Loading…
Cancel
Save