nacos-coredns-plugin

module
v1.9.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2022 License: Apache-2.0

README

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, make sure your golang version is 1.17 or higher as go mod support and other api is needed, and 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:

. {
    log
    nacos {
        nacos_namespaceId public
        nacos_server_host console.nacos.io:8848
   }
   forward . /etc/resolv.conf
 }
  • forward: domain names those not registered in nacos will be forwarded to upstream.
  • nacos_namespaceId: nacos namespaceId, defalut is public.
  • nacos_server_host: Ip and Port of nacos server, seperated by comma if there are two or more nacos servers

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL