Catalog for CoreDNS cattle orchestration.

This commit is contained in:
Jason-ZW 2018-02-27 21:02:50 +08:00 committed by System Administrator
parent bf6c4bda12
commit fde452c869
5 changed files with 253 additions and 0 deletions

View File

@ -0,0 +1,108 @@
## CoreDNS
CoreDNS (written in Go) chains [plugins](https://coredns.io/plugins). Each plugin performs a DNS
function.
CoreDNS is a [Cloud Native Computing Foundation](https://cncf.io) incubating level project.
CoreDNS is a fast and flexible DNS server. The keyword here is *flexible*: with CoreDNS you
are able to do what you want with your DNS data by utilizing plugins. If some functionality is not
provided out of the box you can add it by [writing a plugin](https://coredns.io/explugins).
And more. Each of the plugins is documented. See [coredns.io/plugins](https://coredns.io/plugins)
for all in-tree plugins, and [coredns.io/explugins](https://coredns.io/explugins) for all
out-of-tree plugins.
## Dockerfile
The Dockerfile source is under below:
[https://github.com/Jason-ZW/Dockerfile/tree/master/coredns](https://github.com/Jason-ZW/Dockerfile/tree/master/coredns)
## Parameters
- Publish port: Port to publish coredns service. (eg. 53)
- DNS zone names: you can put multiple zone names.eg. rancher.io,rancher.io,172.in-addr.arpa
- Etcd root path: etcd root path which is used to save records. (eg. /skydns)
- Etcd endpoints: etcd service endpointsthis catalog don't include etcd service,please use external etcd service. (eg. http://localhost:2379, endpoints2, ...)
- UpStream for dns: upstream configuration for dns server. (eg. /etc/resolv.conf)
- Forward addresses: the address which to be forwarded DNS query. (eg. 8.8.8.8:53,8.8.4.4:53)
- Prometheus plugin support: whether to enable prometheus plugin.
- Errors plugin support: whether to enable errors plugin.
- Log plugin support: whether to enable log plugin.
- Proxy plugin support: whether to enable proxy plugin.
- Cache plugin support: whether to enable cache plugin.
- Loadbalance plugin support: whether to enable loadbalance plugin.
More detail for CoreDNS plugin
[https://coredns.io/plugins](https://coredns.io/plugins)
## Guide
Serve for DNS `A/AAAA` Records:
> Put DNS A record to etcd server.
```
curl -XPUT http://{ETCD_ENDPOINT}:2379/v2/keys/skydns/io/rancher/busybox -d value='{"host":"172.16.80.175","port":8080}'
```
> Set `nameserver` to `/etc/resolv.conf`.
```
nameserver {DNS_SERVER_ADDRESS}
search rancher.io
```
> Query DNS use dns tools(eg. `dig` or `nslookup`)
```
nslookup busybox.rancher.io
#output:
Server: xxx.xxx.xxx.xxx
Address: xxx.xxx.xxx.xxx#53
Name: busybox.rancher.io
Address: 172.16.80.175
```
Serve for DNS `PTR` Records:
> Modify the DNS zone names section on Catalog template.
```
# DNS zone names section on Catalog template.
rancher.io,172.in-addr.arpa
```
> Put DNS PTR record to etcd server.
```
curl -XPUT http://{ETCD_ENDPOINT}:2379/v2/keys/skydns/arpa/in-addr/172/16/80/175 -d value='{"host":"busybox.rancher.io"}'
```
> Set `nameserver` to `/etc/resolv.conf`.
```
nameserver {DNS_SERVER_ADDRESS}
search rancher.io
```
> Query DNS use dns tools(eg. `dig` or `nslookup`)
```
dig @localhost -x 172.16.80.175 +short
#output:
busybox.rancher.io.
```
## Community
We're most active on Slack (and Github):
- Slack: #coredns on <https://slack.cncf.io>
- Github: <https://github.com/coredns/coredns>
More resources can be found:
- Website: <https://coredns.io>
- Blog: <https://blog.coredns.io>
- Twitter: [@corednsio](https://twitter.com/corednsio)
- Mailing list/group: <coredns-discuss@googlegroups.com>
**Notice: For kubernetes, please use helm coredns's chart.**

View File

@ -0,0 +1,45 @@
version: '2'
services:
coredns:
image: coredns/coredns:1.0.1
labels:
io.rancher.sidekicks: data
io.rancher.container.hostname_override: container_name
command: [ "-conf", "/etc/coredns/Corefile" ]
ports:
- ${PUBLISH_PORT}:${PUBLISH_PORT}/tcp
- ${PUBLISH_PORT}:${PUBLISH_PORT}/udp
volumes_from:
- data
data:
image: zhenyangzhao/coredns-file:v0.8.0
labels:
io.rancher.container.start_once: 'true'
io.rancher.container.pull_image: always
network_mode: none
entrypoint:
- confd
- -backend
- env
- -onetime
environment:
PLUGIN_ZONES: ${ZONES}
PLUGIN_ROOT_PATH: ${ROOT_PATH}
PLUGIN_ETCD_ENDPOINTS: ${ETCD_ENDPOINTS}
PLUGIN_UPSTREAM: ${UPSTREAM}
PLUGIN_PROM: ${PLUGIN_PROM}
PLUGIN_ERRORS: ${PLUGIN_ERRORS}
PLUGIN_LOG: ${PLUGIN_LOG}
PLUGIN_HEALTH: true
PLUGIN_PROXY: ${PLUGIN_PROXY}
PLUGIN_CACHE: ${PLUGIN_CACHE}
PLUGIN_LOADBALANCE: ${PLUGIN_LOADBALANCE}
PLUGIN_FORWARDS: ${FORWARDS}
PUBLISH_PORT: ${PUBLISH_PORT}
volumes:
- coredns_data:/etc/coredns
volumes:
coredns_data:
driver: local
per_container: true

View File

@ -0,0 +1,92 @@
version: '2'
catalog:
name: "CoreDNS"
version: "1.0.1"
minimum_rancher_version: v1.6.14
description: "CoreDNS is a DNS server that chains plugins and provides such DNS Services like Etcd & Kubernetes. For kubernetes, please use helm coredns's chart."
questions:
- variable: "PUBLISH_PORT"
description: "Port to publish coredns service."
label: "Publish port"
required: true
default: "53"
type: "int"
- variable: "ZONES"
label: "DNS zone names"
description: "The name of an existing zone in which to create the records."
type: "string"
default: "rancher.io"
required: true
- variable: "ROOT_PATH"
label: "Etcd root path"
description: "Etcd root path which is used to save records."
default: "/skydns"
type: "string"
required: true
- variable: "ETCD_ENDPOINTS"
label: "Etcd endpoints"
description: "Etcd service endpoints which support multiple parameters separated by comma."
type: "string"
default: ""
required: true
- variable: "UPSTREAM"
label: "Upstream for dns"
description: "The DNS server upstream."
type: "string"
default: "/etc/resolv.conf"
required: false
- variable: "FORWARDS"
label: "Forward addresses"
description: "The address which to be forwarded DNS query."
type: "string"
default: "8.8.8.8:53,8.8.4.4:53"
- variable: "PLUGIN_PROM"
label: "Prometheus plugin support"
description: "Whether to enable prometheus plugin."
type: "boolean"
default: true
required: true
- variable: "PLUGIN_ERRORS"
label: "Errors plugin support"
description: "Whether to enable errors plugin."
type: "boolean"
default: true
required: true
- variable: "PLUGIN_LOG"
label: "Log plugin support"
description: "Whether to enable log plugin."
type: "boolean"
default: true
required: true
- variable: "PLUGIN_PROXY"
label: "Proxy plugin support"
description: "Whether to enable proxy plugin."
type: "boolean"
default: true
required: true
- variable: "PLUGIN_CACHE"
label: "Cache plugin support"
description: "Whether to enable cache plugin."
type: "boolean"
default: true
required: true
- variable: "PLUGIN_LOADBALANCE"
label: "Loadbalance plugin support"
description: "Whether to enable loadbalance plugin."
type: "boolean"
default: true
required: true
services:
coredns:
scale: 1
health_check:
response_timeout: 4000
healthy_threshold: 2
port: 8080
unhealthy_threshold: 3
initializing_timeout: 60000
interval: 2000
strategy: recreate
request_line: GET "/health" "HTTP/1.0"
reinitializing_timeout: 60000

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@ -0,0 +1,7 @@
name: Core DNS
description: |
CoreDNS is a DNS server that chains plugins and provides such DNS Services like Etcd & Kubernetes.For kubernetes, please use helm coredns's chart.
version: 1.0.1
category: External DNS
labels:
io.rancher.orchestration.supported: 'cattle'