Set cluster DNS in kubeadm config for kubelet dynamic config (#5293)

Change-Id: I23116efefe8626d361d1904fc6fb8448f66cf3c5
pull/5300/head
Matthew Mosesohn 2019-10-25 12:23:40 +03:00 committed by Kubernetes Prow Robot
parent 1a87dcd9b9
commit 81da231b1e
1 changed files with 19 additions and 0 deletions

View File

@ -331,3 +331,22 @@ nodePortAddresses: {{ kube_proxy_nodeport_addresses }}
oomScoreAdj: {{ kube_proxy_oom_score_adj }} oomScoreAdj: {{ kube_proxy_oom_score_adj }}
portRange: {{ kube_proxy_port_range }} portRange: {{ kube_proxy_port_range }}
udpIdleTimeout: {{ kube_proxy_udp_idle_timeout }} udpIdleTimeout: {{ kube_proxy_udp_idle_timeout }}
{# DNS settings for kubelet #}
{% if enable_nodelocaldns %}
{% set kubelet_cluster_dns = [nodelocaldns_ip] %}
{% elif dns_mode in ['coredns'] %}
{% set kubelet_cluster_dns = [skydns_server] %}
{% elif dns_mode == 'coredns_dual' %}
{% set kubelet_cluster_dns = [skydns_server,skydns_server_secondary] %}
{% elif dns_mode == 'manual' %}
{% set kubelet_cluster_dns = [manual_dns_server] %}
{% else %}
{% set kubelet_cluster_dns = [] %}
{% endif %}
---
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
clusterDNS:
{% for dns_address in kubelet_cluster_dns %}
- {{ dns_address }}
{% endfor %}