Description
What would you like to be added:
Currently, external DNS support fqdn-template
parameter. There are certain limitations of this option.
- This provides a single template for all resource types. We would like a separate template for each resource so that a different pattern for DNS can be specified for each type of resource.
- Currently,
fqdn-template
parameter only works for public IP addresses for the resource. We would like to add support for internal or private IPs. - DNS entries are created for only those resources which have the
hostname
annotation
Therefore, To address these limitations this feature adds support for generating DNS entries for all supported Kubernetes resources for DNS (Service, Pod) using resource-type-specific internal DNS templates. This allows users to create DNS records for internal/private IPs for all objects of a given type, not just those with specific annotations.
Different templates are required for each resource type. This requires addition of following parameters
--internal-service-template
--internal-pod-template
In future other parameters can be added for other resource types if required.
Why is this needed:
This feature is required to enable ExternalDNS to fully replace CoreDNS for internal service discovery within Kubernetes clusters. By allowing the creation of DNS entries for internal IP addresses with names matching those generated by CoreDNS, users can seamlessly migrate workloads and DNS-based service discovery from CoreDNS to ExternalDNS.
This allows customers to move dataplane for DNS queries to directly external DNS providers which are highly available and remove dependency on CoreDNS.
Details
New command-line flags:
--internal-service-template
--internal-pod-template
- If a flag is specified, all objects of that type will get a DNS entry using the template and their internal/private IPs.
- If both the regular and internal templates are set, both public and internal DNS entries are created.
- If neither is set, fallback to annotation-based logic.
- Headless services: Internal DNS entries are generated for all endpoints of headless services when the internal template is set.
- DNS names: The DNS entries created should have names that match those generated by CoreDNS for maximum compatibility.
Example Usage
Since, this will be used to replace CoreDNS in a kubernetes cluster. Following is sample configuration of this feature
--internal-service-template = {{.Name}}.{{.Namespace}}.svc.cluster.local
This will instruct ExternalDNS to create DNS records of the specified form in template for all service objects object. These DNS Records will point to internal/private IPs for all services.