Docker Orchestration: Beyond the Basics
Aaron Lehmann Software Engineer, Docker
Docker Orchestration: Beyond the Basics Aaron Lehmann Software - - PowerPoint PPT Presentation
Docker Orchestration: Beyond the Basics Aaron Lehmann Software Engineer, Docker About me Software engineer at Docker Maintainer on SwarmKit and Docker Engine open source projects Focusing on distributed state, task scheduling,
Aaron Lehmann Software Engineer, Docker
2
4
5
mgr-1$ docker swarm init
worker-1$ docker swarm join --token <token> 192.168.65.2:2377
6
containers
application:
mgr-1$ docker service create -p 8080:8080 --name search \
mgr-1$ docker service ls ID NAME REPLICAS IMAGE COMMAND 2xtw9qipmbe9 search 4/4 searchsvc:v1.0
7
mgr-1$ docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS drwxwi4h2fb0tcrwgmpmma2x0 * mgr-1 Ready Active Leader 1mhtdwhvsgr3c26xxbnzdc3yp mgr-2 Ready Active Reachable 516pacagkqp2xc3fk9t1dhjor mgr-3 Ready Active Reachable 9j68exjopxe7wfl6yuxml7a7j worker-1 Ready Active 03g1y59jwfg7cf99w4lt0f662 worker-2 Ready Active dxn1zf6l61qsb1josjja83ngz worker-3 Ready Active
8
Manager Manager Manager Worker Worker Worker Worker Worker Worker
Search service container Billing service container Search service container Search service container Billing service container Search service container
9
Worker Worker Worker Worker Worker Worker
Search service container Billing service container Search service container Search service container Billing service container Search service container
Manager Manager Manager
10
Worker Worker Worker Worker Worker
Search service container Billing service container Search service container Search service container Search service container Billing service container
Manager Manager Manager
12
13
14
15
16
17
18
19
Number of managers Majority Tolerated Failures 1 1 2 2
20
Number of managers Majority Tolerated Failures 1 1 2 2
21
Number of managers Majority Tolerated Failures 1 1 2 2 3 2 1 4 3 1
22
Number of managers Majority Tolerated Failures 1 1 2 2 3 2 1 4 3 1
23
Number of managers Majority Tolerated Failures 1 1 2 2 3 2 1 4 3 1 5 3 2 6 4 2
24
Number of managers Majority Tolerated Failures 1 1 2 2 3 2 1 4 3 1 5 3 2 6 4 2
25
Number of managers Majority Tolerated Failures 1 1 2 2 3 2 1 4 3 1 5 3 2 6 4 2 7 4 3 8 5 3 9 5 4
26
27
28
29
30
31
32
mgr-1$ docker node update --availability=drain <manager id>
33
34
Prepare new Stop old Start new Health checks Update delay Prepare new Stop old Start new Health checks Update delay Prepare new Stop old Prepare new Stop old
Update parallelism
36
37
38
39
mgr-1$ docker swarm join-token worker To add a worker to this swarm, run the following command: docker swarm join \
SWMTKN-1-5f7umqonkff6je2l1kqpxdsok3bwipn73hlr5dxtvx4lusy809
172.17.0.2:2377
40
worker-1$ docker swarm join --token \ SWMTKN-1-5f7umqonkff6je2l1kqpxdsok3bwipn73hlr5dxtvx4lusy809
172.17.0.2:2377 This node joined a swarm as a worker.
41
Join token, certificate request Signed certificate Node registration Task assignments = TLS with no client certificate = Mutually authenticated TLS
42
43
mgr-1$ docker swarm join-token --rotate worker Succesfully rotated worker join token. To add a worker to this swarm, run the following command: docker swarm join \
SWMTKN-1-5f7umqonkff6je2l1kqpxdsok3bwipn73hlr5dxtvx4l usy809-6cq1skbwkkrp2xgv4ak0cgn01 \ 172.17.0.2:2377
44
45
can prove its identity with mutual TLS
mgr-1$ docker swarm update --cert-expiry=1000h
leaked certificate is useful to an attacker
46
47
Join token, cert request Signed certificate Node registration Task assignments
= TLS with no client certificate = Mutually authenticated TLS
Cert request Signed cert
48
49
50
51
53
54
55
56
Node 2
Billing service Billing service Billing service
Node 1
Search service Search service Search service
Node 1 has fewest tasks, so it receives the new task
Search service
57
Node 2
Billing service Billing service Billing service
Node 1
Search service Search service Search service
Node 2 has fewest replicas
receives the new task
Search service
58
mgr-1$ docker service update --rollback <servicename>
59
60
Prepare task 1 Stop old Start task 1 Health checks Update delay Prepare task 2 Stop old
Monitoring period for task 1
Task 1 fails
61