Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reserved memory unit in kubelet configuration #6725

Merged
merged 2 commits into from
Sep 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions inventory/sample/group_vars/k8s-cluster/k8s-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,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
Expand Down
12 changes: 10 additions & 2 deletions roles/kubernetes/node/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions roles/kubernetes/node/templates/kubelet-config.v1beta1.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down