Browse Source

Merge pull request #550 from chadswen/hostname-alias

Hostname alias fixes
pull/603/head
Matthew Mosesohn 8 years ago
committed by GitHub
parent
commit
6da0ecfa55
2 changed files with 2 additions and 2 deletions
  1. 2
      roles/kubernetes/node/templates/kubelet.j2
  2. 2
      roles/kubernetes/preinstall/tasks/etchosts.yml

2
roles/kubernetes/node/templates/kubelet.j2

@ -14,7 +14,7 @@ KUBELET_ADDRESS="--address={{ ip | default("0.0.0.0") }}"
# The port for the info server to serve on
# KUBELET_PORT="--port=10250"
# You may leave this blank to use the actual hostname
KUBELET_HOSTNAME="--hostname-override={{ inventory_hostname }}"
KUBELET_HOSTNAME="--hostname-override={{ ansible_hostname }}"
{% if inventory_hostname in groups['kube-master'] and inventory_hostname not in groups['kube-node'] %}
KUBELET_REGISTER_NODE="--register-node=false"
{% endif %}

2
roles/kubernetes/preinstall/tasks/etchosts.yml

@ -4,7 +4,7 @@
dest: /etc/hosts
block: |-
{% for item in groups['all'] -%}
{{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item].ansible_default_ipv4.address)) }} {{ item }}
{{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item].ansible_default_ipv4.address)) }}{% if (item != hostvars[item]['ansible_hostname']) %} {{ hostvars[item]['ansible_hostname'] }}{% endif %} {{ item }}
{% endfor %}
state: present
create: yes

Loading…
Cancel
Save