mirror of
https://github.com/notherealmarco/coredns-deployment.git
synced 2025-05-05 12:32:34 +02:00
Add Docker 1.12+ (service) based deployment (#9)
This commit is contained in:
parent
901fba81cb
commit
9a3a1a292b
2 changed files with 59 additions and 0 deletions
36
docker/README.md
Normal file
36
docker/README.md
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
# docker based deployment
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
* Docker 1.12.x or later (*Docker Swarm Mode*)
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
First decide which nodes you are going to run coredns on and set appropriate
|
||||||
|
labels on your nodes. I use `iface=extern` as labels on nodes with external
|
||||||
|
facing interfaces and `iface=intern` for internal facing nodes.
|
||||||
|
|
||||||
|
```#!bash
|
||||||
|
$ docker node inspect node1 | jq '.[0].Spec.Labels'
|
||||||
|
{
|
||||||
|
"iface": "extern"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Deploy
|
||||||
|
|
||||||
|
Connect to a "manager" node:
|
||||||
|
(*I use `docker-machine` for this*)
|
||||||
|
|
||||||
|
```#!bash
|
||||||
|
$ eval $(docker-machine env node1)
|
||||||
|
$ docker stack deploy -c dns.yml dns
|
||||||
|
```
|
||||||
|
|
||||||
|
## Verify
|
||||||
|
|
||||||
|
Verify your setup works:
|
||||||
|
|
||||||
|
```#!bash
|
||||||
|
$ dig @<node1> google.com IN A +short
|
||||||
|
```
|
23
docker/dns.yml
Normal file
23
docker/dns.yml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
version: "3.2"
|
||||||
|
|
||||||
|
services:
|
||||||
|
coredns:
|
||||||
|
image: coredns/coredns
|
||||||
|
command: -conf /data/Corefile
|
||||||
|
ports:
|
||||||
|
- "53:53/udp"
|
||||||
|
- "53:53/tcp"
|
||||||
|
- "9153:9153/tcp"
|
||||||
|
volumes:
|
||||||
|
- coredns:/data
|
||||||
|
deploy:
|
||||||
|
mode: global
|
||||||
|
placement:
|
||||||
|
constraints:
|
||||||
|
- "node.labels.iface != extern"
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
coredns:
|
||||||
|
external: true
|
Loading…
Add table
Add a link
Reference in a new issue