Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't work expect #11

Closed
zhangguanzhang opened this issue Feb 2, 2021 · 4 comments
Closed

don't work expect #11

zhangguanzhang opened this issue Feb 2, 2021 · 4 comments

Comments

@zhangguanzhang
Copy link

related kubernetes/dns#436

@leiless
Copy link
Owner

leiless commented Feb 2, 2021

Hi, @zhangguanzhang, I haven't used k8s much, I'll check this later.
It may be some compatibility issues with kubernetes/dns.

Thanks for your feedback.

@zhangguanzhang
Copy link
Author

thanks

@leiless
Copy link
Owner

leiless commented Feb 4, 2021

Hi @zhangguanzhang, I suspect the CoreDNS plugin mechanism(actually it's a Caddyserver) affected the result.

In usual case, one need to edit coredns/plugin.cfg, and run go generate && go build to rebuild the whole CoreDNS.

As a comparison, we use the coredns/example, the plugin still not get working.

diff --git a/cmd/node-cache/main.go b/cmd/node-cache/main.go
index 5a3a4a6..bdf4021 100644
--- a/cmd/node-cache/main.go
+++ b/cmd/node-cache/main.go
@@ -33,6 +33,9 @@ import (
 	_ "github.com/coredns/coredns/plugin/template"
 	_ "github.com/coredns/coredns/plugin/trace"
 	_ "github.com/coredns/coredns/plugin/whoami"
+	//_ "github.com/leiless/dnsredir"
+	_ "github.com/coredns/example"
+
 	"k8s.io/dns/pkg/version"
 )
 
$ cat Corefile
. {
	forward . 9.9.9.9
	example
}

$ sudo ./node-cache -localip 127.0.0.1
2021/02/04 19:52:08 [INFO] Starting node-cache image: 2b7b66c-dirty
2021/02/04 19:52:08 [INFO] Using Corefile
2021/02/04 19:52:08 [WARNING] Unable to lookup IP address of Upstream service kube-dns, env $KUBE_DNS_SERVICE_HOST ``
2021/02/04 19:52:08 [ERROR] Failed to write config file  - err open : no such file or directory
2021/02/04 19:52:08 [INFO] Skipping kube-dns configmap sync as no directory was specified
Corefile:3 - Error during parsing: Unknown directive 'example'

$ ./node-cache -plugins -localip "127.0.0.1" 2> /dev/null | grep example
  dns.example

Q: Why _ "github.com/coredns/coredns/plugin/..." can work as expected?

I suspect mainly because those plugins already embedded in the official CoreDNS builds.

Further details needed to solve this bug.

@zhangguanzhang
Copy link
Author

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants