Docker Cluster: With Swarm, Consul, Registrator and Consul-Template
Docker Cluster: With Swarm, Consul, Registrator and Consul-Template
jmaitrehenry
Overview
Create a swarm cluster
Manage a swarm cluster
Service discovery
Service auto-configuration
2015-06-15
1 linux server
2015-06-15
With docker
Docker daemon
An host running Linux
2015-06-15
Docker daemon
Docker daemon
2015-06-15
2015-06-15
Docker swarm
Docker Swarm is native clustering for Docker. It turns a pool of Docker hosts into a single, virtual host
https://github.com/docker/swarm
2015-06-15
somewhere
Consul have a Key/Value store and swarm can register node
on it
2015-06-15
What is Consul?
Consul host
Docker daemon
Docker daemon
Swarm cluster
2015-06-15
10
With swarm !
dockerrundswarm:0.3.0rc2join
addr=10.1.1.231:2375consul://10.1.8.32:8500/dc1
2015-06-15
11
12
Consul host
Docker daemon
Docker daemon
Swarm cluster
2015-06-15
13
With swarm !
dockerrundp2375:2375swarmmanage
consul://10.1.8.32:8500/dc1
2015-06-15
14
#exportDOCKER_HOST=tcp://<managerIP>:<port>
#docker<dockercmd>
Without TLS enabled (dev only please ) :
# unsetDOCKER_TLS_VERIFY
2015-06-15
15
2015-06-15
16
Register node
Docker
daemo
n
My laptop
Consul host
Docker
daemo
n
An host
Swarm
cluster
Docker
daemo
n
An host
2015-06-15
17
manager
Register node
Docker
daemo
n
My laptop
Consul host
Docker
daemo
n
An host
Swarm
cluster
Docker
daemo
n
An host
2015-06-15
18
manager
Register node
Docker
daemo
n
My laptop
Consul host
Docker
daemo
n
An host
Swarm
cluster
Docker
daemo
n
Manage hosts
An host
2015-06-15
19
2015-06-15
20
Service discovery
2015-06-15
21
2015-06-15
22
Consul
Service details:
http://10.1.8.32:8500/v1/catalog/service/statsd-8125
Consul server
2015-06-15
23
Consul
Service details:
http://10.1.8.32:8500/v1/catalog/service/statsd-8125
Consul server
Docker node
2015-06-15
24
Consul
Service details:
http://10.1.8.32:8500/v1/catalog/service/statsd-8125
Consul server
Docker node
Service address
2015-06-15
25
2015-06-15
26
Registrator
Service registry bridge for Docker
Registrator automatically register/deregisters services for
2015-06-15
27
Registrator
2015-06-15
28
Registrator
29
Registrator
Public node IP
2015-06-15
30
Demo
2015-06-15
31
2015-06-15
32
2015-06-15
33
2015-06-15
34
Consul template
The daemonconsul-templatequeries aConsulinstance and
updates any number of specified templates on the filesystem.
As an added bonus,consul-templatecan optionally run
arbitrary commands when the update process completes
https://github.com/hashicorp/consul-template
2015-06-15
35
2015-06-15
36
consul server.
You could have it in a container
You could have it somewhere else
2015-06-15
37
Service name
2015-06-15
38
Service name
Service IP
2015-06-15
39
Service name
Service IP
Service port
2015-06-15
40
2015-06-15
41
2015-06-15
42
Thanks!
2015-06-15
43