diff --git a/docs/vars.md b/docs/vars.md index c78708351..a7c6ebccf 100644 --- a/docs/vars.md +++ b/docs/vars.md @@ -53,7 +53,7 @@ Kubernetes needs some parameters in order to get deployed. These are the following default cluster paramters: * *cluster_name* - Name of cluster (default is cluster.local) -* *domain_name* - Name of cluster DNS domain (default is cluster.local) +* *dns_domain* - Name of cluster DNS domain (default is cluster.local) * *kube_network_plugin* - Plugin to use for container networking * *kube_service_addresses* - Subnet for cluster IPs (default is 10.233.0.0/18). Must not overlap with kube_pods_subnet diff --git a/roles/kubernetes-apps/ansible/templates/coredns-config.yml.j2 b/roles/kubernetes-apps/ansible/templates/coredns-config.yml.j2 index 34cd4b77e..a89d3fc9e 100644 --- a/roles/kubernetes-apps/ansible/templates/coredns-config.yml.j2 +++ b/roles/kubernetes-apps/ansible/templates/coredns-config.yml.j2 @@ -13,10 +13,18 @@ data: health kubernetes {{ dns_domain }} in-addr.arpa ip6.arpa { pods insecure +{% if resolvconf_mode == 'host_resolvconf' and upstream_dns_servers is defined and upstream_dns_servers|length > 0 %} + upstream {{ upstream_dns_servers|join(' ') }} +{% else %} upstream /etc/resolv.conf +{% endif %} fallthrough in-addr.arpa ip6.arpa } prometheus :9153 +{% if resolvconf_mode == 'host_resolvconf' and upstream_dns_servers is defined and upstream_dns_servers|length > 0 %} + proxy . {{ upstream_dns_servers|join(' ') }} +{% else %} proxy . /etc/resolv.conf +{% endif %} cache 30 } diff --git a/roles/kubernetes-apps/ansible/templates/kubedns-deploy.yml.j2 b/roles/kubernetes-apps/ansible/templates/kubedns-deploy.yml.j2 index e67d3ae37..f6a4c8ff6 100644 --- a/roles/kubernetes-apps/ansible/templates/kubedns-deploy.yml.j2 +++ b/roles/kubernetes-apps/ansible/templates/kubedns-deploy.yml.j2 @@ -97,6 +97,9 @@ spec: - --dns-port=10053 - --config-dir=/kube-dns-config - --v={{ kube_log_level }} +{% if resolvconf_mode == 'host_resolvconf' and upstream_dns_servers is defined and upstream_dns_servers|length > 0 %} + - --nameservers={{ upstream_dns_servers|join(',') }} +{% endif %} env: - name: PROMETHEUS_PORT value: "10055"