Skydns2 and etcd playing nicely
Getting dns up and running
Setup:
I will be running docker on host with ip 10.37.129.6, docker bridge on 192.168.1.1/16, and setting up domain *.deki.local
On with it:
Start up by running etcd with something like this (10.37.129.6 is host address):
#!/bin/bash
HostIP="10.37.129.6"
docker run -d -v /usr/share/ca-certificates/:/etc/ssl/certs \
-p 4001:4001 \
-p 2380:2380 \
-p 2379:2379 \
--name etcd quay.io/coreos/etcd \
-name etcd0 -advertise-client-urls http://${HostIP}:2379,http://${HostIP}:4001 \
-listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \
-initial-advertise-peer-urls http://${HostIP}:2380 \
-listen-peer-urls http://0.0.0.0:2380 \
-initial-cluster-token etcd-cluster-1 \
-initial-cluster etcd0=http://${HostIP}:2380 \
-initial-cluster-state new
At this point we can set up configuration for skydock2 using something like:
#!/bin/bash
curl -XPUT http://10.37.129.6:4001/v2/keys/skydns/config \
-d value='{
"dns_addr":"0.0.0.0:53", \
"pathprefix":"skydns", \
"round_robin":true, \
"domain":"deki.local.", \
"hostmaster":"hm@deki.local", \
"ttl":3600, \
"nameservers": ["8.8.8.8:53","8.8.4.4:53"] \
}'
and start skydock2:
#!/bin/bash
docker run -d -p 10.37.129.6:53:53/udp \
docker.io/skynetservices/skydns \
-machines='http://10.37.129.6:4001' \
-verbose='true'
#create some entry:
curl -XPUT http://10.37.129.6:4001/v2/keys/skydns/local/deki/db1-service/db1 \
-d value='{"host":"191.168.102.121","port":8080}'
##and test it:
dig @10.37.129.6 db1.db1-service.deki.local
Next stop:
Next stop, get skydock running, creating dns entries for containers as they start, and remove them when they exit (or end up killed).
No comments :
Post a Comment