From e26be9cb8a8119ea7cb4cf9209e782e667122323 Mon Sep 17 00:00:00 2001 From: Vladimir Kozyrev Date: Wed, 31 May 2017 12:11:47 +0300 Subject: [PATCH] add private dns server for a specific zone --- inventory/group_vars/k8s-cluster.yml | 5 +++++ roles/dnsmasq/defaults/main.yml | 3 +++ roles/dnsmasq/templates/01-kube-dns.conf.j2 | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/inventory/group_vars/k8s-cluster.yml b/inventory/group_vars/k8s-cluster.yml index ef5e363dc..350be8240 100644 --- a/inventory/group_vars/k8s-cluster.yml +++ b/inventory/group_vars/k8s-cluster.yml @@ -132,3 +132,8 @@ efk_enabled: false # Helm deployment helm_enabled: false + +# dnsmasq +# dnsmasq_upstream_dns_servers: +# - /resolvethiszone.with/10.0.4.250 +# - 8.8.8.8 diff --git a/roles/dnsmasq/defaults/main.yml b/roles/dnsmasq/defaults/main.yml index 58b1b7f1d..bf670c788 100644 --- a/roles/dnsmasq/defaults/main.yml +++ b/roles/dnsmasq/defaults/main.yml @@ -30,3 +30,6 @@ dns_memory_requests: 50Mi # Autoscaler parameters dnsmasq_nodes_per_replica: 10 dnsmasq_min_replicas: 1 + +# Custom name servers +dnsmasq_upstream_dns_servers: [] diff --git a/roles/dnsmasq/templates/01-kube-dns.conf.j2 b/roles/dnsmasq/templates/01-kube-dns.conf.j2 index dce26d726..483be2090 100644 --- a/roles/dnsmasq/templates/01-kube-dns.conf.j2 +++ b/roles/dnsmasq/templates/01-kube-dns.conf.j2 @@ -11,6 +11,11 @@ server=/{{ dns_domain }}/{{ skydns_server }} local=/{{ bogus_domains }} #Set upstream dns servers +{% if dnsmasq_upstream_dns_servers|length > 0 %} +{% for srv in dnsmasq_upstream_dns_servers %} +server={{ srv }} +{% endfor %} +{% endif %} {% if system_and_upstream_dns_servers|length > 0 %} {% for srv in system_and_upstream_dns_servers %} server={{ srv }}