You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `kube-dns` option has been deprecated since 1.18 and no longer
supported. The support to `kube-dns` has been removed from kubeadm since
1.21. This PR tweaks the DNS customization page to remove the outdated
contents and also reformat the paragraphs where appropriate.
As of Kubernetes v1.12, CoreDNS is the recommended DNS Server, replacing kube-dns. If your cluster
34
-
originally used kube-dns, you may still have `kube-dns` deployed rather than CoreDNS.
28
+
using the _addon manager_[cluster add-on](http://releases.k8s.io/master/cluster/addons/README.md).
35
29
36
30
{{< note >}}
37
31
The CoreDNS Service is named `kube-dns` in the `metadata.name` field.
38
-
This is so that there is greater interoperability with workloads that relied on the legacy `kube-dns` Service name to resolve addresses internal to the cluster. Using a Service named `kube-dns` abstracts away the implementation detail of which DNS provider is running behind that common name.
32
+
The intent is to ensure greater interoperability with workloads that relied on
33
+
the legacy `kube-dns` Service name to resolve addresses internal to the cluster.
34
+
Using a Service named `kube-dns` abstracts away the implementation detail of
35
+
which DNS provider is running behind that common name.
39
36
{{< /note >}}
40
37
41
-
If you are running CoreDNS as a Deployment, it will typically be exposed as a Kubernetes Service with a static IP address.
42
-
The kubelet passes DNS resolver information to each container with the `--cluster-dns=<dns-service-ip>` flag.
38
+
If you are running CoreDNS as a Deployment, it will typically be exposed as
39
+
a Kubernetes Service with a static IP address.
40
+
The kubelet passes DNS resolver information to each container with the
41
+
`--cluster-dns=<dns-service-ip>` flag.
43
42
44
43
DNS names also need domains. You configure the local domain in the kubelet
45
44
with the flag `--cluster-domain=<default-local-domain>`.
46
45
47
-
The DNS server supports forward lookups (A and AAAA records), port lookups (SRV records), reverse IP address lookups (PTR records),
48
-
and more. For more information, see [DNS for Services and Pods](/docs/concepts/services-networking/dns-pod-service/).
46
+
The DNS server supports forward lookups (A and AAAA records), port lookups (SRV records),
47
+
reverse IP address lookups (PTR records), and more. For more information, see
48
+
[DNS for Services and Pods](/docs/concepts/services-networking/dns-pod-service/).
49
49
50
50
If a Pod's `dnsPolicy` is set to `default`, it inherits the name resolution
51
51
configuration from the node that the Pod runs on. The Pod's DNS resolution
@@ -59,15 +59,16 @@ inheriting DNS. Set it to a valid file path to specify a file other than
59
59
60
60
## CoreDNS
61
61
62
-
CoreDNS is a general-purpose authoritative DNS server that can serve as cluster DNS, complying with the [dns specifications](https://github.com/kubernetes/dns/blob/master/docs/specification.md).
62
+
CoreDNS is a general-purpose authoritative DNS server that can serve as cluster DNS,
63
+
complying with the [DNS specifications](https://github.com/kubernetes/dns/blob/master/docs/specification.md).
63
64
64
65
### CoreDNS ConfigMap options
65
66
66
-
CoreDNS is a DNS server that is modular and pluggable, and each plugin adds new functionality to CoreDNS.
67
-
This can be configured by maintaining a [Corefile](https://coredns.io/2017/07/23/corefile-explained/), which is the CoreDNS
68
-
configuration file. As a cluster administrator, you can modify the
69
-
{{< glossary_tooltip text="ConfigMap" term_id="configmap" >}} for the CoreDNS Corefile to change how DNS service discovery
70
-
behaves for that cluster.
67
+
CoreDNS is a DNS server that is modular and pluggable, with plugins adding new functionalities.
68
+
The CoreDNS server can be configured by maintaining a [Corefile](https://coredns.io/2017/07/23/corefile-explained/),
69
+
which is the CoreDNS configuration file. As a cluster administrator, you can modify the
70
+
{{< glossary_tooltip text="ConfigMap" term_id="configmap" >}} for the CoreDNS Corefile to
71
+
change how DNS service discovery behaves for that cluster.
71
72
72
73
In Kubernetes, CoreDNS is installed with the following default Corefile configuration:
73
74
@@ -102,35 +103,57 @@ data:
102
103
The Corefile configuration includes the following [plugins](https://coredns.io/plugins/) of CoreDNS:
103
104
104
105
* [errors](https://coredns.io/plugins/errors/): Errors are logged to stdout.
105
-
* [health](https://coredns.io/plugins/health/): Health of CoreDNS is reported to `http://localhost:8080/health`. In this extended syntax `lameduck` will make the process unhealthy then wait for 5 seconds before the process is shut down.
106
-
* [ready](https://coredns.io/plugins/ready/): An HTTP endpoint on port 8181 will return 200 OK, when all plugins that are able to signal readiness have done so.
107
-
* [kubernetes](https://coredns.io/plugins/kubernetes/): CoreDNS will reply to DNS queries based on IP of the services and pods of Kubernetes. You can find [more details](https://coredns.io/plugins/kubernetes/) about that plugin on the CoreDNS website. `ttl` allows you to set a custom TTL for responses. The default is 5 seconds. The minimum TTL allowed is 0 seconds, and the maximum is capped at 3600 seconds. Setting TTL to 0 will prevent records from being cached.
108
-
The `pods insecure` option is provided for backward compatibility with _kube-dns_. You can use the `pods verified` option, which returns an A record only if there exists a pod in same namespace with matching IP. The `pods disabled` option can be used if you don't use pod records.
109
-
* [prometheus](https://coredns.io/plugins/metrics/): Metrics of CoreDNS are available at `http://localhost:9153/metrics` in [Prometheus](https://prometheus.io/) format (also known as OpenMetrics).
110
-
* [forward](https://coredns.io/plugins/forward/): Any queries that are not within the cluster domain of Kubernetes will be forwarded to predefined resolvers (/etc/resolv.conf).
106
+
* [health](https://coredns.io/plugins/health/): Health of CoreDNS is reported to
107
+
`http://localhost:8080/health`. In this extended syntax `lameduck` will make theuprocess
108
+
unhealthy then wait for 5 seconds before the process is shut down.
109
+
* [ready](https://coredns.io/plugins/ready/): An HTTP endpoint on port 8181 will return 200 OK,
110
+
when all plugins that are able to signal readiness have done so.
111
+
* [kubernetes](https://coredns.io/plugins/kubernetes/): CoreDNS will reply to DNS queries
112
+
based on IP of the Services and Pods. You can find [more details](https://coredns.io/plugins/kubernetes/)
113
+
about this plugin on the CoreDNS website.
114
+
- `ttl`allows you to set a custom TTL for responses. The default is 5 seconds.
115
+
The minimum TTL allowed is 0 seconds, and the maximum is capped at 3600 seconds.
116
+
Setting TTL to 0 will prevent records from being cached.
117
+
- The `pods insecure` option is provided for backward compatibility with `kube-dns`.
118
+
- You can use the `pods verified` option, which returns an A record only if there exists a pod
119
+
in the same namespace with a matching IP.
120
+
- The `pods disabled` option can be used if you don't use pod records.
121
+
* [prometheus](https://coredns.io/plugins/metrics/): Metrics of CoreDNS are available at
122
+
`http://localhost:9153/metrics`in the [Prometheus](https://prometheus.io/) format
123
+
(also known as OpenMetrics).
124
+
* [forward](https://coredns.io/plugins/forward/): Any queries that are not within the Kubernetes
125
+
cluster domain are forwarded to predefined resolvers (/etc/resolv.conf).
111
126
* [cache](https://coredns.io/plugins/cache/): This enables a frontend cache.
112
-
* [loop](https://coredns.io/plugins/loop/): Detects simple forwarding loops and halts the CoreDNS process if a loop is found.
113
-
* [reload](https://coredns.io/plugins/reload): Allows automatic reload of a changed Corefile. After you edit the ConfigMap configuration, allow two minutes for your changes to take effect.
114
-
* [loadbalance](https://coredns.io/plugins/loadbalance): This is a round-robin DNS loadbalancer that randomizes the order of A, AAAA, and MX records in the answer.
127
+
* [loop](https://coredns.io/plugins/loop/): Detects simple forwarding loops and
128
+
halts the CoreDNS process if a loop is found.
129
+
* [reload](https://coredns.io/plugins/reload): Allows automatic reload of a changed Corefile.
130
+
After you edit the ConfigMap configuration, allow two minutes for your changes to take effect.
131
+
* [loadbalance](https://coredns.io/plugins/loadbalance): This is a round-robin DNS loadbalancer
132
+
that randomizes the order of A, AAAA, and MX records in the answer.
115
133
116
134
You can modify the default CoreDNS behavior by modifying the ConfigMap.
117
135
118
136
### Configuration of Stub-domain and upstream nameserver using CoreDNS
119
137
120
-
CoreDNS has the ability to configure stubdomains and upstream nameservers using the [forward plugin](https://coredns.io/plugins/forward/).
138
+
CoreDNS has the ability to configure stub-domains and upstream nameservers
139
+
using the [forward plugin](https://coredns.io/plugins/forward/).
121
140
122
141
#### Example
123
-
If a cluster operator has a [Consul](https://www.consul.io/) domain server located at 10.150.0.1, and all Consul names have the suffix .consul.local. To configure it in CoreDNS, the cluster administrator creates the following stanza in the CoreDNS ConfigMap.
142
+
143
+
If a cluster operator has a [Consul](https://www.consul.io/) domain server located at "10.150.0.1",
144
+
and all Consul names have the suffix ".consul.local". To configure it in CoreDNS,
145
+
the cluster administrator creates the following stanza in the CoreDNS ConfigMap.
124
146
125
147
```
126
148
consul.local:53 {
127
-
errors
128
-
cache 30
129
-
forward . 10.150.0.1
130
-
}
149
+
errors
150
+
cache 30
151
+
forward . 10.150.0.1
152
+
}
131
153
```
132
154
133
-
To explicitly force all non-cluster DNS lookups to go through a specific nameserver at 172.16.0.1, point the `forward` to the nameserver instead of `/etc/resolv.conf`
155
+
To explicitly force all non-cluster DNS lookups to go through a specific nameserver at 172.16.0.1,
156
+
point the `forward` to the nameserver instead of `/etc/resolv.conf`
134
157
135
158
```
136
159
forward . 172.16.0.1
@@ -167,88 +190,12 @@ data:
167
190
}
168
191
```
169
192
170
-
The `kubeadm` tool supports automatic translation from the kube-dns ConfigMap
171
-
to the equivalent CoreDNS ConfigMap.
172
-
173
193
{{< note >}}
174
-
While kube-dns accepts an FQDN for stubdomain and nameserver (eg: ns.foo.com), CoreDNS does not support this feature.
194
+
CoreDNS does not support FQDNs for stub-domains and nameservers (eg: "ns.foo.com").
175
195
During translation, all FQDN nameservers will be omitted from the CoreDNS config.
176
196
{{< /note >}}
177
197
178
-
## CoreDNS configuration equivalent to kube-dns
179
-
180
-
CoreDNS supports the features of kube-dns and more.
181
-
A ConfigMap created for kube-dns to support `StubDomains`and `upstreamNameservers` translates to the `forward` plugin in CoreDNS.
182
-
183
-
### Example
184
-
185
-
This example ConfigMap for kube-dns specifies stubdomains and upstreamnameservers:
0 commit comments