From ae47b617e3ad1687ae24d52024ebd5de15f85acf Mon Sep 17 00:00:00 2001 From: Stanislav Makar Date: Mon, 22 Jan 2018 15:08:24 +0200 Subject: [PATCH] Fix 'no such host' problem (#2148) Fix 'no such host' problem reported by commands *kubectl logs* and *kubectl exec* when cloud_provider is OpenStack Closes: #2147 --- roles/kubernetes/node/defaults/main.yml | 2 +- roles/kubernetes/node/templates/kubelet.kubeadm.env.j2 | 2 +- roles/kubernetes/node/templates/kubelet.standard.env.j2 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/kubernetes/node/defaults/main.yml b/roles/kubernetes/node/defaults/main.yml index b78a6e2e1..037c59896 100644 --- a/roles/kubernetes/node/defaults/main.yml +++ b/roles/kubernetes/node/defaults/main.yml @@ -81,7 +81,7 @@ kube_hyperkube_image_repo: "" # If non-empty, will use this string as identification instead of the actual hostname kube_override_hostname: >- - {%- if cloud_provider is defined -%} + {%- if cloud_provider is defined and cloud_provider in [ 'aws' ] -%} {%- else -%} {{ ansible_hostname }} {%- endif -%} diff --git a/roles/kubernetes/node/templates/kubelet.kubeadm.env.j2 b/roles/kubernetes/node/templates/kubelet.kubeadm.env.j2 index 7e0825b9e..a1429c821 100644 --- a/roles/kubernetes/node/templates/kubelet.kubeadm.env.j2 +++ b/roles/kubernetes/node/templates/kubelet.kubeadm.env.j2 @@ -8,8 +8,8 @@ KUBE_LOG_LEVEL="--v={{ kube_log_level }}" KUBELET_ADDRESS="--address={{ kubelet_bind_address }} --node-ip={{ kubelet_address }}" # The port for the info server to serve on # KUBELET_PORT="--port=10250" -# You may leave this blank to use the actual hostname {% if kube_override_hostname|default('') %} +# You may leave this blank to use the actual hostname KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}" {% endif %} {# Base kubelet args #} diff --git a/roles/kubernetes/node/templates/kubelet.standard.env.j2 b/roles/kubernetes/node/templates/kubelet.standard.env.j2 index e692b5bf9..fbb637604 100644 --- a/roles/kubernetes/node/templates/kubelet.standard.env.j2 +++ b/roles/kubernetes/node/templates/kubelet.standard.env.j2 @@ -5,8 +5,8 @@ KUBE_LOG_LEVEL="--v={{ kube_log_level }}" KUBELET_ADDRESS="--address={{ kubelet_bind_address }} --node-ip={{ kubelet_address }}" # The port for the info server to serve on # KUBELET_PORT="--port=10250" -# You may leave this blank to use the actual hostname {% if kube_override_hostname|default('') %} +# You may leave this blank to use the actual hostname KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}" {% endif %} {# Base kubelet args #}