Skip to content

deckhouse/coredns-kubeforward

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kubeforward

CoreDNS external plugin for node-local-dns

kubeforward is a CoreDNS plugin designed to dynamically monitor changes in Kubernetes Services and automatically update the list of DNS forwarders. It observes EndpointSlices associated with a specified Service, dynamically adjusting the DNS forwarding configuration as endpoints are added, removed, or updated.

Key Features

  • Dynamic DNS Forwarding Updates: Automatically tracks changes in EndpointSlices, ensuring the DNS forwarding configuration remains current without manual intervention.
  • Enhanced Reliability and Fault Tolerance: In the event of an API server failure, CoreDNS continues to use the last known list of endpoints, maintaining DNS service stability.

Use Case

The kubeforward plugin is particularly useful for organizing a node-local-dns caching mechanism. In the standard scheme, ClusterIP is used as the upstream, delegating load balancing responsibility to the CNI. However, in the event of an API server failure, the CNI may not be aware of which upstream endpoints are alive. kubeforward allows CoreDNS to handle upstream health checks independently and, in the case of an API server failure, it will still retain the list of endpoints and load balance the requests.

Installation

  1. Add the Plugin to CoreDNS:

    • Clone the CoreDNS repository:
      git clone https://github.com/coredns/coredns
    • Navigate to the project directory:
      cd coredns
    • Add the kubeforward plugin to the plugin.cfg file:
      kubeforward:github.com/yourusername/kubeforward
      
      Ensure that this line is added before the forward:forward line to maintain the correct order of plugin execution.
  2. Build CoreDNS with the New Plugin:

    • Execute the following commands:
      go get github.com/Paramoshka/kubeforward
      go generate
      go build
      This will generate and build CoreDNS with the kubeforward plugin included.

Configuration

The plugin is configured in the Corefile as follows:

.:53 {
    errors
    log
    kubeforward {
        namespace kube-system
        service_name kube-dns
        port_name dns
        expire 10m
        health_check 5s
        prefer_udp
        force_tcp
    }
}

Configuration Parameters

  • namespace (required): Specifies the Kubernetes namespace where the target Service resides.

  • service_name (required): The name of the Service to which DNS queries will be forwarded.

  • port_name: The name of the port in the Service resource responsible for handling DNS queries.

  • expire: Time after which cached connections expire. Default is 10s.

  • health_check: Interval for health checking of upstream servers. Default is 0.5s.

  • force_tcp: Forces the use of TCP for forwarding queries.

  • prefer_udp: Prefers the use of UDP for forwarding queries.

Limitations

Limited Support for Forward Plugin Options: The plugin utilizes the functionality of the forward plugin for serving DNS under the hood but does not support the full list of classic forward options due to the lack of a public interface for configuring options.

License

This project is distributed under the Apache License Version 2.0. See the LICENSE file for details.

About

Coredns kubeforward external plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages