How to Customize 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 Config Map 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, DNS is handled by CoreDNS.
Take a look at the ConfigMap to see the default configuration.
The result should be similar to the following:
Warning: When the Kubernetes Control Plane is redeployed or when the cluster is upgrading to the latest patch, the default CoreDNS configuration is restored.
To understand what this CoreDNS configuration means, please read the CoreDNS official documentation and CoreDNS plugins documentation.
Customizing the CoreDNS configuration
If you want to edit and customize the CoreDNS configuration, it can be done by editing the coredns-custom Config Map, 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 Config Map with the following command:
For example, if you want to use a custom nameserver that will point to your private DNS, here are all the 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 domains can be resolved. This means that public FQDNs are resolved by the public OVHcloud DNS. For example, when resolving
kubernetes.iofrom a Pod, the CoreDNS first resolves to.:53, which is the default nameserver. Then it resolves to the/etc/resolv.confof the underlying worker node. Then it resolves to 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 on the new configuration. For this reason, you need to customize the configuration through the
coredns-customConfig Map. - CoreDNS is configured to reload its configuration (Config Map here) every 30 seconds.
- New Kubernetes clusters will have the new CoreDNS Deployment & Config Maps, whereas the old ones will need to update their control plane to the latest patch.
Go further
Browse all the Managed Kubernetes Service (MKS) guides.
Browse the rest of the OVHcloud US documentation for guides on our other products and services.
Learn more about Managed Kubernetes on the OVHcloud US website.