Browse Source

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
pull/5644/head
Erwan Miran 4 years ago
committed by GitHub
parent
commit
26700e7882
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 5 deletions
  1. 32
      docs/vars.md
  2. 6
      roles/kubernetes/node/defaults/main.yml
  3. 6
      roles/kubernetes/node/templates/kubelet-config.v1beta1.yaml.j2

32
docs/vars.md

@ -156,20 +156,42 @@ node_taints:
### 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_custom_flags:
- "--eviction-hard=memory.available<100Mi"
- "--eviction-soft-grace-period=memory.available=30s"
- "--eviction-soft=memory.available<300Mi"
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
kubelet_custom_flags:
- "--eviction-hard=memory.available<100Mi"
- "--eviction-soft-grace-period=memory.available=30s"
- "--eviction-soft=memory.available<300Mi"
```
This alternative is deprecated and will remain until the flags are completely removed from kubelet
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:

6
roles/kubernetes/node/defaults/main.yml

@ -68,6 +68,12 @@ kubelet_load_modules: false
# default is equal to application default
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
kubelet_custom_flags: []

6
roles/kubernetes/node/templates/kubelet-config.v1beta1.yaml.j2

@ -70,3 +70,9 @@ systemReserved:
{% endif %}
{% endif %}
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 %}
Loading…
Cancel
Save