coredns-deployment/kubernetes/README.md

61 lines
2.8 KiB
Markdown
Raw Permalink Normal View History

2022-11-01 15:11:49 +01:00
# Kubernetes - DEPRECATED
**These kube-dns/CoreDNS migration scripts and templates are deprecated. For deploying coredns, use the coredns helm chart, or the yaml templates maintained by kubeadm.**
## Description
2017-02-22 22:23:11 +01:00
CoreDNS can run in place of the standard Kube-DNS in Kubernetes. Using the *kubernetes*
plugin, CoreDNS will read zone data from a Kubernetes cluster. It implements the
2017-02-22 22:23:11 +01:00
spec defined for Kubernetes DNS-Based service discovery:
https://github.com/kubernetes/dns/blob/master/docs/specification.md
2017-02-22 22:23:11 +01:00
## deploy.sh and coredns.yaml.sed
`deploy.sh` is a convenience script to generate a manifest for running CoreDNS on a cluster
that is currently running standard kube-dns. Using the `coredns.yaml.sed` file as a template,
2017-02-22 22:23:11 +01:00
it creates a ConfigMap and a CoreDNS deployment, then updates the Kube-DNS service selector
to use the CoreDNS deployment. By re-using the existing service, there is no disruption in
servicing requests.
By default, the deployment script also translates the existing kube-dns configuration into the equivalent CoreDNS Corefile.
By providing the `-s` option, the deployment script will skip the translation of the ConfigMap from kube-dns to CoreDNS.
2017-02-22 22:23:11 +01:00
The script doesn't delete the kube-dns deployment or replication controller - you'll have to
2017-11-15 22:36:12 +01:00
do that manually, after deploying CoreDNS.
2017-02-22 22:23:11 +01:00
You should examine the manifest carefully and make sure it is correct for your particular
cluster. Depending on how you have built your cluster and the version you are running,
some modifications to the manifest may be needed.
In the best case scenario, all that's needed to replace Kube-DNS are these commands:
2017-02-22 22:23:11 +01:00
~~~
$ ./deploy.sh | kubectl apply -f -
2017-02-22 22:23:11 +01:00
$ kubectl delete --namespace=kube-system deployment kube-dns
~~~
2018-08-03 15:38:39 +02:00
**NOTE:** You will need to delete the kube-dns deployment (as above) since while CoreDNS and kube-dns are running at the same time, queries may randomly hit either one.
For non-RBAC deployments, you'll need to edit the resulting yaml before applying it:
1. Remove the line `serviceAccountName: coredns` from the `Deployment` section.
2. Remove the `ServiceAccount`, `ClusterRole`, and `ClusterRoleBinding` sections.
## Rollback to kube-dns
In case one wants to revert a Kubernetes cluster running CoreDNS back to kube-dns,
the `rollback.sh` script generates the kube-dns manifest to install kube-dns.
This uses the existing service, there is no disruption in servicing requests.
The script doesn't delete the CoreDNS deployment or replication controller - you'll have to
do that manually, after deploying kube-dns.
These commands will deploy kube-dns replacing CoreDNS:
~~~
$ ./rollback.sh | kubectl apply -f -
$ kubectl delete --namespace=kube-system deployment coredns
~~~
**NOTE:** You will need to delete the CoreDNS deployment (as above) since while CoreDNS and kube-dns are running at the same time, queries may randomly hit either one.