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.

64 lines
3.6 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_LOGGING="--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") }}"
  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. KUBELET_HOSTNAME="--hostname-override={{ ansible_hostname }}"
  10. {# Base kubelet args #}
  11. {% set kubelet_args_base %}--pod-manifest-path={{ kube_manifest_dir }} \
  12. --pod-infra-container-image={{ pod_infra_image_repo }}:{{ pod_infra_image_tag }} \
  13. --kube-reserved cpu={{ kubelet_cpu_limit }},memory={{ kubelet_memory_limit|regex_replace('Mi', 'M') }} \
  14. --node-status-update-frequency={{ kubelet_status_update_frequency }} \
  15. {% if kube_version | version_compare('v1.6', '>=') %}
  16. --enable-cri={{ kubelet_enable_cri }} --cgroups-per-qos={{ kubelet_cgroups_per_qos }} \
  17. --enforce-node-allocatable='{{ kubelet_enforce_node_allocatable }}' {% endif %}{% endset %}
  18. {# DNS settings for kubelet #}
  19. {% if dns_mode == 'kubedns' %}
  20. {% set kubelet_args_cluster_dns %}--cluster_dns={{ skydns_server }}{% endset %}
  21. {% elif dns_mode == 'dnsmasq_kubedns' %}
  22. {% set kubelet_args_cluster_dns %}--cluster_dns={{ dns_server }}{% endset %}
  23. {% else %}
  24. {% set kubelet_args_cluster_dns %}{% endset %}
  25. {% endif %}
  26. {% set kubelet_args_dns %}{{ kubelet_args_cluster_dns }} --cluster_domain={{ dns_domain }} --resolv-conf={{ kube_resolv_conf }}{% endset %}
  27. {# Location of the apiserver #}
  28. {% set kubelet_args_kubeconfig %}--kubeconfig={{ kube_config_dir}}/node-kubeconfig.yaml --require-kubeconfig{% endset %}
  29. {% if standalone_kubelet|bool %}
  30. {# We are on a master-only host. Make the master unschedulable in this case. #}
  31. {% set kubelet_args_kubeconfig %}{{ kubelet_args_kubeconfig }} --register-schedulable=false{% endset %}
  32. {% endif %}
  33. {# Kubelet node labels #}
  34. {% if inventory_hostname in groups['kube-master'] %}
  35. {% set node_labels %}--node-labels=node-role.kubernetes.io/master=true{% endset %}
  36. {% if not standalone_kubelet|bool %}
  37. {% set node_labels %}{{ node_labels }},node-role.kubernetes.io/node=true{% endset %}
  38. {% endif %}
  39. {% else %}
  40. {% set node_labels %}--node-labels=node-role.kubernetes.io/node=true{% endset %}
  41. {% endif %}
  42. KUBELET_ARGS="{{ kubelet_args_base }} {{ kubelet_args_dns }} {{ kubelet_args_kubeconfig }} {{ node_labels }} {% if kubelet_custom_flags is string %} {{kubelet_custom_flags}} {% else %}{% for flag in kubelet_custom_flags %} {{flag}} {% endfor %}{% endif %}"
  43. {% if kube_network_plugin is defined and kube_network_plugin in ["calico", "weave", "canal"] %}
  44. KUBELET_NETWORK_PLUGIN="--network-plugin=cni --network-plugin-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin"
  45. {% elif kube_network_plugin is defined and kube_network_plugin == "weave" %}
  46. DOCKER_SOCKET="--docker-endpoint=unix:/var/run/weave/weave.sock"
  47. {% elif kube_network_plugin is defined and kube_network_plugin == "cloud" %}
  48. # Please note that --reconcile-cidr is deprecated and a no-op in Kubernetes 1.5 but still required in 1.4
  49. KUBELET_NETWORK_PLUGIN="--hairpin-mode=promiscuous-bridge --network-plugin=kubenet --reconcile-cidr=true"
  50. {% endif %}
  51. # Should this cluster be allowed to run privileged docker containers
  52. KUBE_ALLOW_PRIV="--allow-privileged=true"
  53. {% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere"] %}
  54. KUBELET_CLOUDPROVIDER="--cloud-provider={{ cloud_provider }} --cloud-config={{ kube_config_dir }}/cloud_config"
  55. {% elif cloud_provider is defined and cloud_provider == "aws" %}
  56. KUBELET_CLOUDPROVIDER="--cloud-provider={{ cloud_provider }}"
  57. {% else %}
  58. KUBELET_CLOUDPROVIDER=""
  59. {% endif %}