You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
2.9 KiB

  1. KUBE_LOGTOSTDERR="--logtostderr=true"
  2. KUBE_LOG_LEVEL="--v={{ kube_log_level }}"
  3. KUBELET_ADDRESS="--node-ip={{ kubelet_address }}"
  4. {% if kube_override_hostname|default('') %}
  5. KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
  6. {% endif %}
  7. {# Base kubelet args #}
  8. {% set kubelet_args_base -%}
  9. {# start kubeadm specific settings #}
  10. --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf \
  11. --config={{ kube_config_dir }}/kubelet-config.yaml \
  12. --kubeconfig={{ kube_config_dir }}/kubelet.conf \
  13. {# end kubeadm specific settings #}
  14. {% if container_manager == 'docker' %}
  15. --pod-infra-container-image={{ pod_infra_image_repo }}:{{ pod_infra_image_tag }} \
  16. {% else %}
  17. --container-runtime=remote \
  18. --container-runtime-endpoint=unix://{{ cri_socket }} \
  19. {% endif %}
  20. {% if dynamic_kubelet_configuration %}
  21. --dynamic-config-dir={{ dynamic_kubelet_configuration_dir }} \
  22. {% endif %}
  23. --runtime-cgroups={{ kubelet_runtime_cgroups }} \
  24. {% endset %}
  25. {# Kubelet node taints for gpu #}
  26. {% if nvidia_gpu_nodes is defined and nvidia_accelerator_enabled|bool %}
  27. {% if inventory_hostname in nvidia_gpu_nodes and node_taints is defined %}
  28. {% set dummy = node_taints.append('nvidia.com/gpu=:NoSchedule') %}
  29. {% elif inventory_hostname in nvidia_gpu_nodes and node_taints is not defined %}
  30. {% set node_taints = [] %}
  31. {% set dummy = node_taints.append('nvidia.com/gpu=:NoSchedule') %}
  32. {% endif %}
  33. {% endif %}
  34. KUBELET_ARGS="{{ kubelet_args_base }} {% if node_taints|default([]) %}--register-with-taints={{ node_taints | join(',') }} {% endif %} {% if kube_feature_gates %} --feature-gates={{ kube_feature_gates|join(',') }} {% endif %} {% if kubelet_custom_flags is string %} {{kubelet_custom_flags}} {% else %}{% for flag in kubelet_custom_flags %} {{flag}} {% endfor %}{% endif %}{% if inventory_hostname in groups['kube-node'] %}{% if kubelet_node_custom_flags is string %} {{kubelet_node_custom_flags}} {% else %}{% for flag in kubelet_node_custom_flags %} {{flag}} {% endfor %}{% endif %}{% endif %}"
  35. {% if kubelet_flexvolumes_plugins_dir is defined %}
  36. KUBELET_VOLUME_PLUGIN="--volume-plugin-dir={{ kubelet_flexvolumes_plugins_dir }}"
  37. {% endif %}
  38. {% if kube_network_plugin is defined and kube_network_plugin in ["calico", "canal", "cni", "flannel", "weave", "contiv", "cilium", "kube-ovn", "ovn4nfv", "kube-router", "macvlan"] %}
  39. KUBELET_NETWORK_PLUGIN="--network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin"
  40. {% elif kube_network_plugin is defined and kube_network_plugin == "cloud" %}
  41. KUBELET_NETWORK_PLUGIN="--hairpin-mode=promiscuous-bridge --network-plugin=kubenet"
  42. {% endif %}
  43. {% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws", "external"] %}
  44. KUBELET_CLOUDPROVIDER="--cloud-provider={{ cloud_provider }} --cloud-config={{ kube_config_dir }}/cloud_config"
  45. {% else %}
  46. KUBELET_CLOUDPROVIDER=""
  47. {% endif %}
  48. PATH={{ bin_dir }}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin