From 8ece922ef093ebf09d1b21a9ba99e79b054aee18 Mon Sep 17 00:00:00 2001 From: Erwan Miran Date: Sat, 31 Mar 2018 00:30:42 +0200 Subject: [PATCH] node_labels documentation + kube-ingress label handling as role_node_label --- docs/vars.md | 8 +++++++- roles/kubernetes/node/templates/kubelet.standard.env.j2 | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/vars.md b/docs/vars.md index f4956c882..a4ae65678 100644 --- a/docs/vars.md +++ b/docs/vars.md @@ -119,7 +119,13 @@ Stack](https://github.com/kubernetes-incubator/kubespray/blob/master/docs/dns-st cgroup-driver option for Kubelet. By default autodetection is used to match Docker configuration. * *node_labels* - Labels applied to nodes via kubelet --node-labels parameter. - For example, labels can be set in the inventory as variables or more widely in group_vars + For example, labels can be set in the inventory as variables or more widely in group_vars. + *node_labels* must be defined as a dict: +``` +node_labels: + label1_name: label1_value + label2_name: label2_value +``` ##### 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. Example: diff --git a/roles/kubernetes/node/templates/kubelet.standard.env.j2 b/roles/kubernetes/node/templates/kubelet.standard.env.j2 index 50a5441e0..cd48fca9c 100644 --- a/roles/kubernetes/node/templates/kubelet.standard.env.j2 +++ b/roles/kubernetes/node/templates/kubelet.standard.env.j2 @@ -88,7 +88,7 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}" {% do role_node_labels.append('node-role.kubernetes.io/node=true') %} {% endif %} {% elif inventory_hostname in groups['kube-ingress']|default([]) %} -{% set node_labels %}--node-labels=node-role.kubernetes.io/ingress=true{% endset %} +{% do role_node_labels.append('node-role.kubernetes.io/ingress=true') %} {% else %} {% do role_node_labels.append('node-role.kubernetes.io/node=true') %} {% endif %}