Customizing CoreDNS on an OVHcloud Managed Kubernetes cluster
Objective
The OVHcloud Managed Kubernetes service provides you with Kubernetes clusters without the hassle of installing or operating them.
The OVHcloud Managed Kubernetes clusters are using CoreDNS as a DNS server for Service Discovery.
At OVHcloud, we listen to our users and improve our products and services accordingly, which is why we give you the ability to customize the CoreDNS configuration, thanks to the expansion mechanism in a special ConfigMap which is not modified by a redeployment.
Requirements
- An OVHcloud Managed Kubernetes cluster
Instructions
Displaying the CoreDNS default configuration
In an OVHcloud Managed Kubernetes cluster the DNS are handled by CoreDNS.
Take a look at the ConfigMap to see the default configuration.
The result should be similar to the following:
When the Kubernetes Control Plane is redeployed or when the cluster is upgrading to the latest patch, this default CoreDNS configuration is restored to the default one.
To understand what this CoreDNS configuration means, please read the CoreDNS official documentation and CoreDNS plugins documentation.
Customizing the CoreDNS configuration
Changing the default CoreDNS configuration can lead to errors if not done correctly.
If you want to edit and customize the CoreDNS configuration, it can be done by editing the coredns-custom ConfigMap, which will never be altered by OVHCloud services:
You can add some new configuration in data.example.include and data.example.server blocks.
Edit the coredns-custom ConfigMap with the following command:
For example, if you want to use a custom nameserver that will point to your private DNS all FQDN resolutions for *.myprivatedomain.com:
Check the logs to make sure that the customization has been applied:
Known limitations
-
Full private DNS resolution is not possible, only private domain can be resolved. This means that public FQDN are resolved by the public OVHcloud DNS. For example, when resolving
kubernetes.iofrom a Pod, first the CoreDNS resolves to.:53which is the default nameserver then it resolves the/etc/resolv.confof the underlying worker Node. Then it resolves the public OVHcloud DNS (which is configured by the OVHcloud Managed Kubernetes). -
When upgrading the cluster Nodes (or when a node restarts), the CoreDNS pod can be restarted and takes the new configuration. That's for this reason you need to customize the configuration through the
coredns-customConfigMap. -
CoreDNS is configured to reload its configuration (ConfigMap here) every 30 seconds.
-
New Kubernetes clusters will have the new CoreDNS Deployment & ConfigMaps, whereas the old ones will need to update their control plane to the latest patch.
Go further
To have an overview of the OVHcloud Managed Kubernetes service, you can go to the OVHcloud Managed Kubernetes page.
To learn more about how to use your Kubernetes cluster the practical way, we invite you to read our tutorials.
-
If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link to get a quote and ask our Professional Services experts for assisting you on your specific use case of your project.
-
Join our community of users.