Fix reserved memory unit in kubelet configuration (#6725)

* Fix reserved memory unit in kubelet configuration

Signed-off-by: Wang Zhen <lazybetrayer@gmail.com>

* Move systemReserved default values from template

Signed-off-by: Wang Zhen <lazybetrayer@gmail.com>
This commit is contained in:
Wang Zhen 2020-09-23 06:20:09 +08:00 committed by GitHub
parent 80df4f8b01
commit edea63511d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 10 deletions

View file

@ -245,10 +245,10 @@ podsecuritypolicy_enabled: false
## Optionally reserve resources for OS system daemons.
# system_reserved: true
## Uncomment to override default values
# system_memory_reserved: 512M
# system_memory_reserved: 512Mi
# system_cpu_reserved: 500m
## Reservation for master hosts
# system_master_memory_reserved: 256M
# system_master_memory_reserved: 256Mi
# system_master_cpu_reserved: 250m
# An alternative flexvolume plugin directory

View file

@ -23,12 +23,20 @@ kubelet_kubelet_cgroups: "/systemd/system.slice"
kubelet_fail_swap_on: true
# Reserve this space for kube resources
kube_memory_reserved: 256M
kube_memory_reserved: 256Mi
kube_cpu_reserved: 100m
# Reservation for master hosts
kube_master_memory_reserved: 512M
kube_master_memory_reserved: 512Mi
kube_master_cpu_reserved: 200m
# Set to true to reserve resources for system daemons
system_reserved: false
system_memory_reserved: 512Mi
system_cpu_reserved: 500m
# Reservation for master hosts
system_master_memory_reserved: 256Mi
system_master_cpu_reserved: 250m
kubelet_status_update_frequency: 10s
# Requests for load balancer app

View file

@ -60,19 +60,19 @@ clusterDNS:
kubeReserved:
{% if is_kube_master|bool %}
cpu: {{ kube_master_cpu_reserved }}
memory: {{ kube_master_memory_reserved|regex_replace('Mi', 'M') }}
memory: {{ kube_master_memory_reserved }}
{% else %}
cpu: {{ kube_cpu_reserved }}
memory: {{ kube_memory_reserved|regex_replace('Mi', 'M') }}
memory: {{ kube_memory_reserved }}
{% endif %}
{% if system_reserved is defined and system_reserved %}
systemReserved:
{% if is_kube_master|bool %}
cpu: {{ system_master_cpu_reserved|default('250m') }}
memory: {{ system_master_memory_reserved|default('256M')|regex_replace('Mi', 'M') }}
cpu: {{ system_master_cpu_reserved }}
memory: {{ system_master_memory_reserved }}
{% else %}
cpu: {{ system_cpu_reserved|default('500m') }}
memory: {{ system_memory_reserved|default('512M')|regex_replace('Mi', 'M') }}
cpu: {{ system_cpu_reserved }}
memory: {{ system_memory_reserved }}
{% endif %}
{% endif %}
resolvConf: "{{ kube_resolv_conf }}"