Update documentation on CoreDNS (#10923)
* update documentation on CoreDNS * Update dns-custom-nameservers.md Fixed nit noted in comments and cleaned up a few more things while I was in there. This whole topic needs a complete redo, but this PR is an iterative improvment. Thanks!
This commit is contained in:
committed by
k8s-ci-robot
parent
2bfdd42aa7
commit
6f3b8cbd9b
@@ -122,7 +122,7 @@ about the [service proxy](/docs/concepts/services-networking/service/#virtual-ip
|
|||||||
|
|
||||||
Kubernetes supports 2 primary modes of finding a Service - environment variables
|
Kubernetes supports 2 primary modes of finding a Service - environment variables
|
||||||
and DNS. The former works out of the box while the latter requires the
|
and DNS. The former works out of the box while the latter requires the
|
||||||
[kube-dns cluster addon](http://releases.k8s.io/{{< param "githubbranch" >}}/cluster/addons/dns/kube-dns/README.md).
|
[CoreDNS cluster addon](http://releases.k8s.io/{{< param "githubbranch" >}}/cluster/addons/dns/coredns).
|
||||||
|
|
||||||
### Environment Variables
|
### Environment Variables
|
||||||
|
|
||||||
@@ -178,7 +178,7 @@ kube-dns ClusterIP 10.0.0.10 <none> 53/UDP,53/TCP 8m
|
|||||||
|
|
||||||
If it isn't running, you can [enable it](http://releases.k8s.io/{{< param "githubbranch" >}}/cluster/addons/dns/README.md#how-do-i-configure-it).
|
If it isn't running, you can [enable it](http://releases.k8s.io/{{< param "githubbranch" >}}/cluster/addons/dns/README.md#how-do-i-configure-it).
|
||||||
The rest of this section will assume you have a Service with a long lived IP
|
The rest of this section will assume you have a Service with a long lived IP
|
||||||
(my-nginx), and a DNS server that has assigned a name to that IP (the kube-dns
|
(my-nginx), and a DNS server that has assigned a name to that IP (the CoreDNS
|
||||||
cluster addon), so you can talk to the Service from any pod in your cluster using
|
cluster addon), so you can talk to the Service from any pod in your cluster using
|
||||||
standard methods (e.g. gethostbyname). Let's run another curl application to test this:
|
standard methods (e.g. gethostbyname). Let's run another curl application to test this:
|
||||||
|
|
||||||
|
|||||||
@@ -258,6 +258,9 @@ kubectl -n kube-system get deployment coredns -o yaml | \
|
|||||||
kubectl apply -f -
|
kubectl apply -f -
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Another cause for CoreDNS to have `CrashLoopBackOff` is when a CoreDNS Pod deployed in Kubernetes detects a loop. [A number of workarounds](https://github.com/coredns/coredns/tree/master/plugin/loop#troubleshooting-loops-in-kubernetes-clusters)
|
||||||
|
are available to avoid Kubernetes trying to restart the CoreDNS Pod every time CoreDNS detects the loop and exits.
|
||||||
|
|
||||||
{{< warning >}}
|
{{< warning >}}
|
||||||
Disabling SELinux or setting `allowPrivilegeEscalation` to `true` can compromise
|
Disabling SELinux or setting `allowPrivilegeEscalation` to `true` can compromise
|
||||||
the security of your cluster.
|
the security of your cluster.
|
||||||
|
|||||||
@@ -134,11 +134,11 @@ You'll see a list of pods that looks something like this (the name specifics wil
|
|||||||
|
|
||||||
```shell
|
```shell
|
||||||
NAMESPACE NAME READY STATUS RESTARTS AGE
|
NAMESPACE NAME READY STATUS RESTARTS AGE
|
||||||
|
kube-system coredns-5f4fbb68df-mc8z8 1/1 Running 0 15m
|
||||||
kube-system fluentd-cloud-logging-kubernetes-minion-63uo 1/1 Running 0 14m
|
kube-system fluentd-cloud-logging-kubernetes-minion-63uo 1/1 Running 0 14m
|
||||||
kube-system fluentd-cloud-logging-kubernetes-minion-c1n9 1/1 Running 0 14m
|
kube-system fluentd-cloud-logging-kubernetes-minion-c1n9 1/1 Running 0 14m
|
||||||
kube-system fluentd-cloud-logging-kubernetes-minion-c4og 1/1 Running 0 14m
|
kube-system fluentd-cloud-logging-kubernetes-minion-c4og 1/1 Running 0 14m
|
||||||
kube-system fluentd-cloud-logging-kubernetes-minion-ngua 1/1 Running 0 14m
|
kube-system fluentd-cloud-logging-kubernetes-minion-ngua 1/1 Running 0 14m
|
||||||
kube-system kube-dns-v5-7ztia 3/3 Running 0 15m
|
|
||||||
kube-system kube-ui-v1-curt1 1/1 Running 0 15m
|
kube-system kube-ui-v1-curt1 1/1 Running 0 15m
|
||||||
kube-system monitoring-heapster-v5-ex4u3 1/1 Running 1 15m
|
kube-system monitoring-heapster-v5-ex4u3 1/1 Running 1 15m
|
||||||
kube-system monitoring-influx-grafana-v1-piled 2/2 Running 0 15m
|
kube-system monitoring-influx-grafana-v1-piled 2/2 Running 0 15m
|
||||||
|
|||||||
@@ -63,6 +63,11 @@ value to `false`:
|
|||||||
kubeadm init --feature-gates=CoreDNS=false
|
kubeadm init --feature-gates=CoreDNS=false
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Tuning CoreDNS
|
||||||
|
|
||||||
|
When resource utilisation is a concern, it may be useful to tune the configuration of CoreDNS. For more details, check out the
|
||||||
|
[documentation on scaling CoreDNS]((https://github.com/coredns/deployment/blob/master/kubernetes/Scaling_CoreDNS.md)).
|
||||||
|
|
||||||
{{% /capture %}}
|
{{% /capture %}}
|
||||||
|
|
||||||
{{% capture whatsnext %}}
|
{{% capture whatsnext %}}
|
||||||
|
|||||||
@@ -103,10 +103,10 @@ The Corefile configuration includes the following [plugins](https://coredns.io/p
|
|||||||
* [proxy](https://coredns.io/plugins/proxy/): Any queries that are not within the cluster domain of Kubernetes will be forwarded to predefined resolvers (/etc/resolv.conf).
|
* [proxy](https://coredns.io/plugins/proxy/): Any queries that are not within the cluster domain of Kubernetes will be forwarded to predefined resolvers (/etc/resolv.conf).
|
||||||
* [cache](https://coredns.io/plugins/cache/): This enables a frontend cache.
|
* [cache](https://coredns.io/plugins/cache/): This enables a frontend cache.
|
||||||
* [loop](https://coredns.io/plugins/loop/): Detects simple forwarding loops and halts the CoreDNS process if a loop is found.
|
* [loop](https://coredns.io/plugins/loop/): Detects simple forwarding loops and halts the CoreDNS process if a loop is found.
|
||||||
* [reload](https://coredns.io/plugins/reload): Allows automatic reload of a changed Corefile.
|
* [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.
|
||||||
* [loadbalance](https://coredns.io/plugins/loadbalance): This is a round-robin DNS loadbalancer by randomizing the order of A, AAAA, and MX records in the answer.
|
* [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.
|
||||||
|
|
||||||
We can modify the default behavior by modifying this configmap.
|
You can modify the default CoreDNS behavior by modifying the ConfigMap.
|
||||||
|
|
||||||
### Configuration of Stub-domain and upstream nameserver using CoreDNS
|
### Configuration of Stub-domain and upstream nameserver using CoreDNS
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ proxy . 172.16.0.1
|
|||||||
upstream 172.16.0.1
|
upstream 172.16.0.1
|
||||||
```
|
```
|
||||||
|
|
||||||
So, the final ConfigMap along with the default `Corefile` configuration will look like:
|
The final ConfigMap along with the default `Corefile` configuration looks like:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
@@ -307,9 +307,9 @@ data:
|
|||||||
|
|
||||||
## CoreDNS configuration equivalent to kube-dns
|
## CoreDNS configuration equivalent to kube-dns
|
||||||
|
|
||||||
CoreDNS supports all the functionalities and more that is provided by kube-dns.
|
CoreDNS supports the features of kube-dns and more.
|
||||||
A ConfigMap created for kube-dns to support `StubDomains`and `upstreamNameservers` translates to the `proxy` plugin in CoreDNS.
|
A ConfigMap created for kube-dns to support `StubDomains`and `upstreamNameservers` translates to the `proxy` plugin in CoreDNS.
|
||||||
Similarly, the `Federation` plugin translates to the `federation` plugin in CoreDNS.
|
Similarly, the `Federations` plugin in kube-dns translates to the `federation` plugin in CoreDNS.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
@@ -380,12 +380,10 @@ The complete Corefile with the default plugins:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
In Kubernetes version 1.10 and later, kubeadm supports automatic translation of the CoreDNS ConfigMap from the kube-dns ConfigMap.
|
|
||||||
|
|
||||||
## Migration to CoreDNS
|
## Migration to CoreDNS
|
||||||
|
|
||||||
To migrate from kube-dns to CoreDNS, [a detailed blog](https://coredns.io/2018/05/21/migration-from-kube-dns-to-coredns/) is available to help users adapt CoreDNS in place of kube-dns.
|
To migrate from kube-dns to CoreDNS, [a detailed blog](https://coredns.io/2018/05/21/migration-from-kube-dns-to-coredns/) is available to help users adapt CoreDNS in place of kube-dns.
|
||||||
A cluster administrator can also migrate using [the deploy script](https://github.com/coredns/deployment/blob/master/kubernetes/deploy.sh), which will also help you translate the kube-dns configmap to the equivalent CoreDNS one.
|
A cluster administrator can also migrate using [the deploy script](https://github.com/coredns/deployment/blob/master/kubernetes/deploy.sh).
|
||||||
|
|
||||||
## What's next
|
## What's next
|
||||||
- [Debugging DNS Resolution](/docs/tasks/administer-cluster/dns-debugging-resolution/).
|
- [Debugging DNS Resolution](/docs/tasks/administer-cluster/dns-debugging-resolution/).
|
||||||
|
|||||||
Reference in New Issue
Block a user