Skip to content
Snippets Groups Projects
Unverified Commit a3e34f58 authored by Cristian Calin's avatar Cristian Calin Committed by GitHub
Browse files

Enable Graceful Node Shutdown for Kubernetes >= 1.21.0 (#7746)

* Enable Graceful Node Shutdown for Kubernetes >= 1.21.0

* Add sample graceful shutdown parameters
parent a2cf6816
No related branches found
No related tags found
No related merge requests found
...@@ -149,6 +149,10 @@ kube_proxy_nodeport_addresses: >- ...@@ -149,6 +149,10 @@ kube_proxy_nodeport_addresses: >-
## Encrypting Secret Data at Rest (experimental) ## Encrypting Secret Data at Rest (experimental)
kube_encrypt_secret_data: false kube_encrypt_secret_data: false
# Graceful Node Shutdown (Kubernetes >= 1.21.0), see https://kubernetes.io/blog/2021/04/21/graceful-node-shutdown-beta/
# kubelet_shutdown_grace_period: 60s
# kubelet_shutdown_grace_period_critical_pods: 20s
# DNS configuration. # DNS configuration.
# Kubernetes cluster name, also will be used as DNS domain # Kubernetes cluster name, also will be used as DNS domain
cluster_name: cluster.local cluster_name: cluster.local
......
...@@ -96,3 +96,7 @@ tlsCipherSuites: ...@@ -96,3 +96,7 @@ tlsCipherSuites:
{% if kubelet_event_record_qps %} {% if kubelet_event_record_qps %}
eventRecordQPS: {{ kubelet_event_record_qps }} eventRecordQPS: {{ kubelet_event_record_qps }}
{% endif %} {% endif %}
{% if kube_version is version('v1.21.0', '>=') %}
shutdownGracePeriod: {{ kubelet_shutdown_grace_period }}
shutdownGracePeriodCriticalPods: {{ kubelet_shutdown_grace_period_critical_pods }}
{% endif %}
...@@ -107,6 +107,13 @@ ...@@ -107,6 +107,13 @@
- not ignore_assert_errors - not ignore_assert_errors
- inventory_hostname in groups['kube_node'] - inventory_hostname in groups['kube_node']
- name: Stop when ShutdownGracePeriod less than ShutdownGracePeriodCriticalPods
assert:
that: kubelet_shutdown_grace_period > kubelet_shutdown_grace_period_critical_pods
msg: "ShutdownGracePeriod ({{ kubelet_shutdown_grace_period }}) needs to be greater than ShutdownGracePeriodCriticalPods ({{ kubelet_shutdown_grace_period_critical_pods }}) in order to give normal pods time to be evacuated, please see https://kubernetes.io/blog/2021/04/21/graceful-node-shutdown-beta/ for details"
when:
- kube_version is version('v1.21.0', '>=')
# This assertion will fail on the safe side: One can indeed schedule more pods # This assertion will fail on the safe side: One can indeed schedule more pods
# on a node than the CIDR-range has space for when additional pods use the host # on a node than the CIDR-range has space for when additional pods use the host
# network namespace. It is impossible to ascertain the number of such pods at # network namespace. It is impossible to ascertain the number of such pods at
......
...@@ -230,6 +230,13 @@ kube_api_aggregator_routing: false ...@@ -230,6 +230,13 @@ kube_api_aggregator_routing: false
# Profiling # Profiling
kube_profiling: false kube_profiling: false
# Graceful Node Shutdown
# This requires kubernetes >= 1.21.0
kubelet_shutdown_grace_period: 60s
# kubelet_shutdown_grace_period_critical_pods should be less than kubelet_shutdown_grace_period
# to give normal pods time to be gracefully evacuated
kubelet_shutdown_grace_period_critical_pods: 20s
# Container for runtime # Container for runtime
container_manager: docker container_manager: docker
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment