From fde452c86958c675ec73d827fdaf63583b619547 Mon Sep 17 00:00:00 2001 From: Jason-ZW Date: Tue, 27 Feb 2018 21:02:50 +0800 Subject: [PATCH] Catalog for CoreDNS cattle orchestration. --- templates/coredns/0/README.md | 108 ++++++++++++++++++++++ templates/coredns/0/docker-compose.yml | 45 +++++++++ templates/coredns/0/rancher-compose.yml | 92 ++++++++++++++++++ templates/coredns/catalogIcon-coredns.svg | 1 + templates/coredns/config.yml | 7 ++ 5 files changed, 253 insertions(+) create mode 100644 templates/coredns/0/README.md create mode 100644 templates/coredns/0/docker-compose.yml create mode 100644 templates/coredns/0/rancher-compose.yml create mode 100644 templates/coredns/catalogIcon-coredns.svg create mode 100644 templates/coredns/config.yml diff --git a/templates/coredns/0/README.md b/templates/coredns/0/README.md new file mode 100644 index 0000000..7a15183 --- /dev/null +++ b/templates/coredns/0/README.md @@ -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 endpoints,this 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 +- Github: + +More resources can be found: + +- Website: +- Blog: +- Twitter: [@corednsio](https://twitter.com/corednsio) +- Mailing list/group: + +**Notice: For kubernetes, please use helm coredns's chart.** \ No newline at end of file diff --git a/templates/coredns/0/docker-compose.yml b/templates/coredns/0/docker-compose.yml new file mode 100644 index 0000000..f218f4c --- /dev/null +++ b/templates/coredns/0/docker-compose.yml @@ -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 + diff --git a/templates/coredns/0/rancher-compose.yml b/templates/coredns/0/rancher-compose.yml new file mode 100644 index 0000000..6c484b2 --- /dev/null +++ b/templates/coredns/0/rancher-compose.yml @@ -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 + diff --git a/templates/coredns/catalogIcon-coredns.svg b/templates/coredns/catalogIcon-coredns.svg new file mode 100644 index 0000000..a5bac8f --- /dev/null +++ b/templates/coredns/catalogIcon-coredns.svg @@ -0,0 +1 @@ +CoreDNS_Colour_Icon \ No newline at end of file diff --git a/templates/coredns/config.yml b/templates/coredns/config.yml new file mode 100644 index 0000000..cae9015 --- /dev/null +++ b/templates/coredns/config.yml @@ -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' \ No newline at end of file