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.

93 lines
5.2 KiB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. # logging to stderr means we get it in the systemd journal
  2. KUBE_LOGTOSTDERR="--logtostderr=true"
  3. KUBE_LOG_LEVEL="--v={{ kube_log_level }}"
  4. # The address for the info server to serve on (set to 0.0.0.0 or "" for all interfaces)
  5. KUBELET_ADDRESS="--address={{ ip | default("0.0.0.0") }} {% if ip is defined %} --node-ip={{ ip }}{% endif %}"
  6. # The port for the info server to serve on
  7. # KUBELET_PORT="--port=10250"
  8. # You may leave this blank to use the actual hostname
  9. {% if kube_override_hostname %}
  10. KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
  11. {% endif %}
  12. {# Base kubelet args #}
  13. {% set kubelet_args_base %}--pod-manifest-path={{ kube_manifest_dir }} \
  14. --pod-infra-container-image={{ pod_infra_image_repo }}:{{ pod_infra_image_tag }} \
  15. --node-status-update-frequency={{ kubelet_status_update_frequency }} \
  16. --docker-disable-shared-pid={{ kubelet_disable_shared_pid }} \
  17. --client-ca-file={{ kube_cert_dir }}/ca.pem \
  18. --tls-cert-file={{ kube_cert_dir }}/node-{{ inventory_hostname }}.pem \
  19. --tls-private-key-file={{ kube_cert_dir }}/node-{{ inventory_hostname }}-key.pem \
  20. {% if kube_version | version_compare('v1.6', '>=') %}
  21. {# flag got removed with 1.7.0 #}
  22. {% if kube_version | version_compare('v1.7', '<') %}
  23. --enable-cri={{ kubelet_enable_cri }} \
  24. {% endif %}
  25. --cgroup-driver={{ kubelet_cgroup_driver|default(kubelet_cgroup_driver_detected) }} \
  26. --cgroups-per-qos={{ kubelet_cgroups_per_qos }} \
  27. {% if kube_version | version_compare('v1.8', '<') %}
  28. --experimental-fail-swap-on={{ kubelet_fail_swap_on|default(true)}} \
  29. {% else %}
  30. --fail-swap-on={{ kubelet_fail_swap_on|default(true)}} \
  31. {% endif %}
  32. --enforce-node-allocatable={{ kubelet_enforce_node_allocatable }} {% endif %}{% endset %}
  33. {# DNS settings for kubelet #}
  34. {% if dns_mode == 'kubedns' %}
  35. {% set kubelet_args_cluster_dns %}--cluster-dns={{ skydns_server }}{% endset %}
  36. {% elif dns_mode == 'dnsmasq_kubedns' %}
  37. {% set kubelet_args_cluster_dns %}--cluster-dns={{ dnsmasq_dns_server }}{% endset %}
  38. {% else %}
  39. {% set kubelet_args_cluster_dns %}{% endset %}
  40. {% endif %}
  41. {% set kubelet_args_dns %}{{ kubelet_args_cluster_dns }} --cluster-domain={{ dns_domain }} --resolv-conf={{ kube_resolv_conf }}{% endset %}
  42. {# Location of the apiserver #}
  43. {% set kubelet_args_kubeconfig %}--kubeconfig={{ kube_config_dir}}/node-kubeconfig.yaml --require-kubeconfig{% endset %}
  44. {% if standalone_kubelet|bool %}
  45. {# We are on a master-only host. Make the master unschedulable in this case. #}
  46. {% if kube_version | version_compare('v1.6', '>=') %}
  47. {# Set taints on the master so that it's unschedulable by default. Use node-role.kubernetes.io/master taint like kubeadm. #}
  48. {% set kubelet_args_kubeconfig %}{{ kubelet_args_kubeconfig }} --register-with-taints=node-role.kubernetes.io/master=:NoSchedule{% endset %}
  49. {% else %}
  50. {# --register-with-taints was added in 1.6 so just register unschedulable if Kubernetes < 1.6 #}
  51. {% set kubelet_args_kubeconfig %}{{ kubelet_args_kubeconfig }} --register-schedulable=false{% endset %}
  52. {% endif %}
  53. {% endif %}
  54. {# Node reserved CPU/memory #}
  55. {% if is_kube_master|bool %}
  56. {% set kubelet_reserve %}--kube-reserved cpu={{ kubelet_master_cpu_limit }},memory={{ kubelet_master_memory_limit|regex_replace('Mi', 'M') }}{% endset %}
  57. {% else %}
  58. {% set kubelet_reserve %}--kube-reserved cpu={{ kubelet_cpu_limit }},memory={{ kubelet_memory_limit|regex_replace('Mi', 'M') }}{% endset %}
  59. {% endif %}
  60. {# Kubelet node labels #}
  61. {% if inventory_hostname in groups['kube-master'] %}
  62. {% set node_labels %}--node-labels=node-role.kubernetes.io/master=true{% endset %}
  63. {% if not standalone_kubelet|bool %}
  64. {% set node_labels %}{{ node_labels }},node-role.kubernetes.io/node=true{% endset %}
  65. {% endif %}
  66. {% else %}
  67. {% set node_labels %}--node-labels=node-role.kubernetes.io/node=true{% endset %}
  68. {% endif %}
  69. KUBELET_ARGS="{{ kubelet_args_base }} {{ kubelet_args_dns }} {{ kubelet_args_kubeconfig }} {{ kubelet_reserve }} {{ node_labels }} {% 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 %}"
  70. {% if kube_network_plugin is defined and kube_network_plugin in ["calico", "canal", "flannel", "weave"] %}
  71. KUBELET_NETWORK_PLUGIN="--network-plugin=cni --network-plugin-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin"
  72. {% elif kube_network_plugin is defined and kube_network_plugin == "weave" %}
  73. DOCKER_SOCKET="--docker-endpoint=unix:/var/run/weave/weave.sock"
  74. {% elif kube_network_plugin is defined and kube_network_plugin == "cloud" %}
  75. KUBELET_NETWORK_PLUGIN="--hairpin-mode=promiscuous-bridge --network-plugin=kubenet"
  76. {% endif %}
  77. # Should this cluster be allowed to run privileged docker containers
  78. KUBE_ALLOW_PRIV="--allow-privileged=true"
  79. {% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere"] %}
  80. KUBELET_CLOUDPROVIDER="--cloud-provider={{ cloud_provider }} --cloud-config={{ kube_config_dir }}/cloud_config"
  81. {% elif cloud_provider is defined and cloud_provider == "aws" %}
  82. KUBELET_CLOUDPROVIDER="--cloud-provider={{ cloud_provider }}"
  83. {% else %}
  84. KUBELET_CLOUDPROVIDER=""
  85. {% endif %}
  86. PATH={{ bin_dir }}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin