Skip to content

niwey2010/nacos-coredns-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project provides a DNS-F client based on CoreDNS, which can help export those registed services on Nacos as DNS domain. DNS-F client is a dedicated agent process(side car) beside the application's process to foward the service discovery DNS domain query request to Nacos.

Quic Start

To build and run nacos coredns plugin, the OS must be Linux or Mac. And also, golang environments(GOPATH,GOROOT,GOHOME) must be configured correctly.

Build

git clone https://github.com/nacos-group/nacos-coredns-plugin.git 
cp nacos-coredns-plugin/bin/build.sh ~/
cd ~/
sh build.sh

Configuration

To run nacos coredns plugin, you need a configuration file. A possible file may be as bellow:

. {
    nacos {
        upstream /etc/resolv.conf
        nacos_server 127.0.0.1
        nacos_server_port 8848
   }
 }
  • upstream: domain names those not registered in nacos will be forwarded to upstream.
  • nacos_server: Ips of nacos server, seperated by comma if there are two or more nacos servers
  • nacos_server_port: Nacos server port

Run

  • Firstly, you need to deploy nacos server. Here
  • Secondly, register service on nacos.
  • Then run $GOPATH/src/coredns/coredns -conf $path_to_corefile -dns.port $dns_port image

Test

dig $nacos_service_name @127.0.0.1 -p $dns_port

image

About

Nacos DNS-F Client Based On CoreDNS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 98.2%
  • Shell 1.8%