惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

小众软件
小众软件
MyScale Blog
MyScale Blog
N
News and Events Feed by Topic
IT之家
IT之家
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
The Cloudflare Blog
博客园 - 聂微东
Apple Machine Learning Research
Apple Machine Learning Research
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
美团技术团队
V
Visual Studio Blog
M
MIT News - Artificial intelligence
V
V2EX
博客园_首页
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Blog — PlanetScale
Blog — PlanetScale
F
Full Disclosure
H
Help Net Security
MongoDB | Blog
MongoDB | Blog
博客园 - 叶小钗
S
SegmentFault 最新的问题
博客园 - 三生石上(FineUI控件)
D
Docker
Engineering at Meta
Engineering at Meta
博客园 - Franky
aimingoo的专栏
aimingoo的专栏
Jina AI
Jina AI
N
Netflix TechBlog - Medium
宝玉的分享
宝玉的分享
大猫的无限游戏
大猫的无限游戏
人人都是产品经理
人人都是产品经理
云风的 BLOG
云风的 BLOG
博客园 - 司徒正美
I
InfoQ
G
Google Developers Blog
L
LangChain Blog
F
Fortinet All Blogs
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
WordPress大学
WordPress大学
A
Arctic Wolf
Martin Fowler
Martin Fowler
G
GRAHAM CLULEY
L
LINUX DO - 热门话题
C
Cisco Blogs
Y
Y Combinator Blog
罗磊的独立博客

Documentation on CoreDNS: DNS and Service Discovery

Cluster DNS: CoreDNS vs Kube-DNS Scaling CoreDNS in Kubernetes Clusters Migration from kube-dns to CoreDNS Deploying Kubernetes with CoreDNS using kubeadm Quick Start Corefile Explained How Queries Are Processed in CoreDNS Custom DNS Entries For Kubernetes CoreDNS for Minikube CoreDNS for Kubernetes Service Discovery, Take 2 How to Add Plugins to CoreDNS History of CoreDNS in four posts. Writing Plugins for CoreDNS DNS over HTTPS CoreDNS for Kubernetes Service Discovery Quick Start for Windows Query Routing
Compile Time Enabling or Disabling Plugins
miek · 2017-07-25 · via Documentation on CoreDNS: DNS and Service Discovery

CoreDNS’ plugins (or external plugins) can be enabled or disabled on the fly by specifying (or not specifying) it in the Corefile. But you can also compile CoreDNS with only the plugins you need and leave the rest completely out.

There are two ways to achieve that. It could be done via compile-time configuration file with CoreDNS code base update. It also could be achieved without modifying CoreDNS code.

Build with compile-time configuration file

The with compile-time configuration file, plugin.cfg is all you need to update. It looks like this:

...
whoami:whoami
erratic:erratic
example:github.com/coredns/example
...

The ordering of the plugins is specified by how they are ordered in this file. Each line consists of a name and a repository. Just add or remove your plugin in this file.

Then do a go get <plugin-repo-path> if you need to get the external plugin’s source code. And then just compile CoreDNS with go generate and a go build. You can then check if CoreDNS has the new plugin with coredns -plugins.

Build with external golang source code

Alternatively, you could assemble plugins from different places through an external golang program. It looks like this:

package main

import (
        _ "github.com/coredns/example"

        "github.com/coredns/coredns/coremain"
        "github.com/coredns/coredns/core/dnsserver"
)

var directives = []string{
        "example",
        ...
        ...
        "whoami",
        "startup",
        "shutdown",
}

func init() {
        dnsserver.Directives = directives
}

func main() {
        coremain.Run()
}

In the above sample code, the external plugin example has been imported with:

        _ "github.com/coredns/example"

The directives should also be updated through:

        dnsserver.Directives = directives

The ordering of the plugins is specified by how the arey ordered in the slice directives.

Then you can just compile CoreDNS with go build to have the binary generated with the plugins you selected.