kubelet_config_extra_args and kubelet_node_config_extra_args (#5623)

* Introduce kubelet_config_extra_args and kubelet_node_config_extra_args to pass params to kubelet via YAML config

* kubelet_config_extra_args is not the alternative
This commit is contained in:
Erwan Miran 2020-02-15 01:05:28 +01:00 committed by GitHub
parent d86229dc2b
commit 26700e7882
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 5 deletions

View file

@ -156,7 +156,32 @@ node_taints:
### Custom flags for Kube Components ### Custom flags for Kube Components
For all kube components, custom flags can be passed in. This allows for edge cases where users need changes to the default deployment that may not be applicable to all deployments. This can be done by providing a list of flags. The `kubelet_node_custom_flags` apply kubelet settings only to nodes and not masters. Example: For all kube components, custom flags can be passed in. This allows for edge cases where users need changes to the default deployment that may not be applicable to all deployments.
Extra flags for the kubelet can be specified using these variables,
in the form of dicts of key-value pairs of configuration parameters that will be inserted into the kubelet YAML config file. The `kubelet_node_config_extra_args` apply kubelet settings only to nodes and not masters. Example:
```yml
kubelet_config_extra_args:
EvictionHard:
memory.available: "<100Mi"
EvictionSoftGracePeriod:
memory.available: "30s"
EvictionSoft:
memory.available: "<300Mi"
```
The possible vars are:
* *kubelet_config_extra_args*
* *kubelet_node_config_extra_args*
Previously, the same paramaters could be passed as flags to kubelet binary with the following vars:
* *kubelet_custom_flags*
* *kubelet_node_custom_flags*
The `kubelet_node_custom_flags` apply kubelet settings only to nodes and not masters. Example:
```yml ```yml
kubelet_custom_flags: kubelet_custom_flags:
@ -165,10 +190,7 @@ kubelet_custom_flags:
- "--eviction-soft=memory.available<300Mi" - "--eviction-soft=memory.available<300Mi"
``` ```
The possible vars are: This alternative is deprecated and will remain until the flags are completely removed from kubelet
* *kubelet_custom_flags*
* *kubelet_node_custom_flags*
Extra flags for the API server, controller, and scheduler components can be specified using these variables, Extra flags for the API server, controller, and scheduler components can be specified using these variables,
in the form of dicts of key-value pairs of configuration parameters that will be inserted into the kubeadm YAML config file: in the form of dicts of key-value pairs of configuration parameters that will be inserted into the kubeadm YAML config file:

View file

@ -68,6 +68,12 @@ kubelet_load_modules: false
# default is equal to application default # default is equal to application default
kubelet_max_pods: 110 kubelet_max_pods: 110
## Support parameters to be passed to kubelet via kubelet-config.yaml
kubelet_config_extra_args: {}
## Support parameters to be passed to kubelet via kubelet-config.yaml only on nodes, not masters
kubelet_node_config_extra_args: {}
## Support custom flags to be passed to kubelet ## Support custom flags to be passed to kubelet
kubelet_custom_flags: [] kubelet_custom_flags: []

View file

@ -70,3 +70,9 @@ systemReserved:
{% endif %} {% endif %}
{% endif %} {% endif %}
resolvConf: "{{ kube_resolv_conf }}" resolvConf: "{{ kube_resolv_conf }}"
{% if kubelet_config_extra_args %}
{{ kubelet_config_extra_args | to_nice_yaml(indent=2) }}
{% endif %}
{% if inventory_hostname in groups['kube-node'] and kubelet_node_config_extra_args %}
{{ kubelet_node_config_extra_args | to_nice_yaml(indent=2) }}
{% endif %}