diff --git a/content/rancher/v2.x/en/cluster-provisioning/rke-clusters/options/_index.md b/content/rancher/v2.x/en/cluster-provisioning/rke-clusters/options/_index.md index bfeafda0668..2fd56740622 100644 --- a/content/rancher/v2.x/en/cluster-provisioning/rke-clusters/options/_index.md +++ b/content/rancher/v2.x/en/cluster-provisioning/rke-clusters/options/_index.md @@ -109,6 +109,16 @@ Instead of using the Rancher UI to choose Kubernetes options for the cluster, ad For an example of RKE config file syntax, see the [RKE documentation]({{< baseurl >}}/rke/latest/en/example-yamls/). +### Default DNS provider + +The table below indicates what DNS provider is deployed by default. See [RKE documentation on DNS provider]({{< baseurl >}}/rke/latest/en/config-options/add-ons/dns/) for more information how to configure a different DNS provider. CoreDNS can only be used on Kubernetes v1.12.0 and higher. + +| Rancher version | Kubernetes version | Default DNS provider | +|-------------|--------------------|----------------------| +| v2.2.5 and higher | v1.14.0 and higher | CoreDNS | +| v2.2.5 and higher | v1.13.x and lower | kube-dns | +| v2.2.4 and lower | any | kube-dns | + ### Rancher specific parameters _Available as of v2.2.0_ diff --git a/content/rke/latest/en/config-options/_index.md b/content/rke/latest/en/config-options/_index.md index b1ad9fa6f07..ce568009de1 100644 --- a/content/rke/latest/en/config-options/_index.md +++ b/content/rke/latest/en/config-options/_index.md @@ -27,10 +27,12 @@ There are several options that can be configured in cluster configuration option * [Authorization]({{< baseurl >}}/rke/latest/en/config-options/authorization/) * [Cloud Providers]({{< baseurl >}}/rke/latest/en/config-options/cloud-providers/) * [Add-ons]({{< baseurl >}}/rke/latest/en/config-options/add-ons/) - * [Add-ons Jobs Timeout](#add-ons-jobs-timeout) - * [Network Plugins]({{< baseurl >}}/rke/latest/en/config-options/add-ons/network-plugins/) - * [Ingress Controller]({{< baseurl >}}/rke/latest/en/config-options/add-ons/ingress-controllers/) - * [User-Defined-Add-ons]({{< baseurl >}}/rke/latest/en/config-options/add-ons/user-defined-add-ons/) + * [Network Plug-ins]({{< baseurl >}}/rke/latest/en/config-options/add-ons/network-plugins/) + * [DNS providers]({{< baseurl >}}/rke/latest/en/config-options/add-ons/dns/) + * [Ingress Controllers]({{< baseurl >}}/rke/latest/en/config-options/add-ons/ingress-controllers/) + * [Metrics Server]({{< baseurl >}}/rke/latest/en/config-options/add-ons/metrics-server/) + * [User-Defined Add-ons]({{< baseurl >}}/rke/latest/en/config-options/add-ons/user-defined-add-ons/) + * [Add-ons Job Timeout](#add-ons-job-timeout) ## Cluster Level Options diff --git a/content/rke/latest/en/config-options/add-ons/dns/_index.md b/content/rke/latest/en/config-options/add-ons/dns/_index.md index 193690140b9..9ba9d5ff33d 100644 --- a/content/rke/latest/en/config-options/add-ons/dns/_index.md +++ b/content/rke/latest/en/config-options/add-ons/dns/_index.md @@ -1,9 +1,64 @@ --- -title: DNS provider +title: DNS providers weight: 262 --- -By default, RKE deploys [kube-dns](https://github.com/kubernetes/dns) as DNS provider for your cluster. +RKE provides the following DNS providers that can be deployed as add-ons: + + * [CoreDNS](https://coredns.io) + * [kube-dns](https://github.com/kubernetes/dns) + +| RKE version | Kubernetes version | Default DNS provider | +|-------------|--------------------|----------------------| +| v0.2.5 and higher | v1.14.0 and higher | CoreDNS | +| v0.2.5 and higher | v1.13.x and lower | kube-dns | +| v0.2.4 and lower | any | kube-dns | + +CoreDNS was made the default in RKE v0.2.5 when using Kubernetes 1.14 and higher. If you are using an RKE version lower than v0.2.5, kube-dns will be deployed by default. + +# CoreDNS + +_Available as of v0.2.5_ + +CoreDNS can only be used on Kubernetes v1.12.0 and higher. + +RKE will deploy CoreDNS as a Deployment with the default replica count of 1. The pod consists of 1 container: `coredns`. RKE will also deploy coredns-autoscaler as a Deployment, which will scale the coredns Deployment by using the number of cores and nodes. Please see [Linear Mode](https://github.com/kubernetes-incubator/cluster-proportional-autoscaler#linear-mode) for more information about this logic. + +The images used for CoreDNS are under the [`system_images` directive]({{< baseurl >}}/rke/latest/en/config-options/system-images/). For each Kubernetes version, there are default images associated with CoreDNS, but these can be overridden by changing the image tag in `system_images`. + +## Scheduling CoreDNS + +If you only want the CoreDNS pod to be deployed on specific nodes, you can set a `node_selector` in the `dns` section. The label in the `node_selector` would need to match the label on the nodes for the CoreDNS pod to be deployed. + +```yaml +nodes: + - address: 1.1.1.1 + role: [controlplane,worker,etcd] + user: root + labels: + app: dns + +dns: + provider: coredns + node_selector: + app: dns +``` + +## Configuring CoreDNS + +### Upstream nameservers + +By default, CoreDNS will use the host configured nameservers (usually residing at `/etc/resolv.conf`) to resolve external queries. If you want to configure specific upstream nameservers to be used by CoreDNS, you can use the `upstreamnameservers` directive. + +```yaml +dns: + provider: coredns + upstreamnameservers: + - 1.1.1.1 + - 8.8.4.4 +``` + +# kube-dns RKE will deploy kube-dns as a Deployment with the default replica count of 1. The pod consists of 3 containers: `kubedns`, `dnsmasq` and `sidecar`. RKE will also deploy kube-dns-autoscaler as a Deployment, which will scale the kube-dns Deployment by using the number of cores and nodes. Please see [Linear Mode](https://github.com/kubernetes-incubator/cluster-proportional-autoscaler#linear-mode) for more information about this logic. @@ -29,16 +84,6 @@ dns: app: dns ``` -## Disabling kube-dns - -_Available as of v0.2.0_ - -You can disable the default DNS provider by specifying `none` to the dns `provider` directive in the cluster configuration. Be aware that this will prevent your pods from doing name resolution in your cluster. - -```yaml -dns: - provider: none -``` ## Configuring kube-dns ### Upstream nameservers @@ -55,16 +100,13 @@ dns: - 8.8.4.4 ``` -## CoreDNS (Experimental) +# Disabling deployment of a DNS provider _Available as of v0.2.0_ -If you want to use CoreDNS, you can set the `provider` directive to `coredns`. Both the `node_selector` and `upstreamnameservers` directive is also supported for CoreDNS. +You can disable the default DNS provider by specifying `none` to the dns `provider` directive in the cluster configuration. Be aware that this will prevent your pods from doing name resolution in your cluster. ```yaml dns: - provider: coredns - upstreamnameservers: - - 1.1.1.1 - - 8.8.4.4 + provider: none ``` diff --git a/content/rke/latest/en/example-yamls/_index.md b/content/rke/latest/en/example-yamls/_index.md index 1fa897d4571..0b9db0fbc29 100644 --- a/content/rke/latest/en/example-yamls/_index.md +++ b/content/rke/latest/en/example-yamls/_index.md @@ -185,6 +185,10 @@ addon_job_timeout: 30 network: plugin: canal +# Specify DNS provider (coredns or kube-dns) +dns: + provider: coredns + # Currently only nginx ingress provider is supported. # To disable ingress controller, set `provider: none`