diff --git a/inventory/sample/group_vars/k8s-cluster/k8s-cluster.yml b/inventory/sample/group_vars/k8s-cluster/k8s-cluster.yml index c80b29684..0767927a1 100644 --- a/inventory/sample/group_vars/k8s-cluster/k8s-cluster.yml +++ b/inventory/sample/group_vars/k8s-cluster/k8s-cluster.yml @@ -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 diff --git a/roles/kubernetes/node/defaults/main.yml b/roles/kubernetes/node/defaults/main.yml index e0adc0beb..b1fb2a26e 100644 --- a/roles/kubernetes/node/defaults/main.yml +++ b/roles/kubernetes/node/defaults/main.yml @@ -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 diff --git a/roles/kubernetes/node/templates/kubelet-config.v1beta1.yaml.j2 b/roles/kubernetes/node/templates/kubelet-config.v1beta1.yaml.j2 index f6e62b580..bd5f0eaa3 100644 --- a/roles/kubernetes/node/templates/kubelet-config.v1beta1.yaml.j2 +++ b/roles/kubernetes/node/templates/kubelet-config.v1beta1.yaml.j2 @@ -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 }}"