diff --git a/.gitignore b/.gitignore index 9856fd0db..1f81f20d5 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.iml temp .idea +.vscode .tox .cache *.bak diff --git a/inventory/sample/group_vars/k8s_cluster/k8s-cluster.yml b/inventory/sample/group_vars/k8s_cluster/k8s-cluster.yml index 509624201..482905c68 100644 --- a/inventory/sample/group_vars/k8s_cluster/k8s-cluster.yml +++ b/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 diff --git a/roles/kubernetes/node/defaults/main.yml b/roles/kubernetes/node/defaults/main.yml index 800c43f41..e47d72a71 100644 --- a/roles/kubernetes/node/defaults/main.yml +++ b/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 diff --git a/roles/kubernetes/node/templates/kubelet-config.v1beta1.yaml.j2 b/roles/kubernetes/node/templates/kubelet-config.v1beta1.yaml.j2 index 56f6edc7d..de1b74b64 100644 --- a/roles/kubernetes/node/templates/kubelet-config.v1beta1.yaml.j2 +++ b/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 %}