orchestration in docker
play

Orchestration in Docker Swarm mode, Docker services and declarative - PowerPoint PPT Presentation

Orchestration in Docker Swarm mode, Docker services and declarative application deployment Mike Goelzer & Victor Vieux Docker Orchestration Overview Mike Goelzer / mgoelzer@docker.com / gh: mgoelzer Orchestration in Docker Orchestration


  1. Orchestration in Docker Swarm mode, Docker services and declarative application deployment Mike Goelzer & Victor Vieux Docker

  2. Orchestration Overview Mike Goelzer / mgoelzer@docker.com / gh: mgoelzer

  3. Orchestration in Docker Orchestration ● ○ Swarm Mode ○ Docker Services ○ Security ○ Routing mesh Container Healthcheck ●

  4. Swarm Mode Engine $ docker swarm init

  5. Swarm Mode Engine Engine $ docker swarm init $ docker swarm join <IP of manager>:2377

  6. Swarm Mode Engine Engine Engine Engine Engine Engine $ docker swarm init $ docker swarm join <IP of manager>:2377

  7. Services Engine Engine Engine mynet Engine Engine Engine $ docker service create --replicas 3 --name frontend --network mynet --publish 80:80/tcp frontend_image:latest

  8. Services Engine Engine Engine mynet Engine Engine Engine $ docker service create --replicas 3 --name frontend --network mynet --publish 80:80/tcp frontend_image:latest $ docker service create --name redis --network mynet redis:latest

  9. Node Failure Engine Engine Engine mynet Engine Engine Engine $ docker service create --replicas 3 --name frontend --network mynet --publish 80:80/tcp frontend_image:latest $ docker service create --name redis --network mynet redis:latest

  10. Node Failure Engine Engine Engine mynet Engine Engine Engine $ docker service create --replicas 3 --name frontend --network mynet --publish 80:80/tcp frontend_image:latest $ docker service create --name redis --network mynet redis:latest

  11. Desired State ≠ Actual State Engine Engine Engine mynet Engine Engine $ docker service create --replicas 3 --name frontend --network mynet --publish 80:80/tcp frontend_image:latest $ docker service create --name redis --network mynet redis:latest

  12. Converge Back to Desired State mynet Engine Engine Engine Engine Engine $ docker service create --replicas 3 --name frontend --network mynet --publish 80:80/tcp frontend_image:latest $ docker service create --name redis --network mynet redis:latest

  13. Scaling mynet Engine Engine Engine Engine Engine $ docker service scale frontend=6

  14. Scaling mynet Engine Engine Engine Engine Engine $ docker service scale frontend=10

  15. Global Services mynet Engine Engine Engine Engine Engine $ docker service create --mode=global --name prometheus prom/prometheus

  16. Constraints docker daemon --label Engine com.example.storage="ssd" Engine Engine Engine docker daemon --label Engine Engine com.example.storage="ssd"

  17. Constraints Engine docker daemon --label com.example.storage="ssd" Engine Engine Engine docker daemon --label Engine Engine com.example.storage="ssd" $ docker service create --replicas 3 --name frontend --network mynet --publish 80:80/tcp --constraint engline.labels.com.example.storage==ssd frontend_image:latest

  18. Constraints Engine docker daemon --label com.example.storage="ssd" Engine Engine Engine docker daemon --label Engine Engine com.example.storage="ssd" $ docker service create --replicas 3 --name frontend --network mynet --publish 80:80/tcp --constraint engline.labels.com.example.storage==ssd frontend_image:latest $ docker service scale frontend=10

  19. Services

  20. Services are grouped into stacks

  21. Swarm mode orchestration is optional You don’t have to use it ● 1.12 is fully backwards compatible ● Will not break existing deployments and scripts ●

  22. Routing Mesh User accesses • Operator reserves a myapp.com:8080 :8080 swarm-wide ingress port Manager (8080) for myapp • Every node listens on 8080 • Container-aware routing mesh can transparently reroute :8080 :8080 :8080 traffic from Worker3 to a node Worker 1 Worker 2 Worker 3 that is running container • Built in load balancing into the Engine frontend frontend frontend • DNS-based service discovery $ docker service create --replicas 3 --name frontend --network mynet -p 8080:80 frontend_image:latest

  23. Routing Mesh: Published Ports User accesses • Operator reserves a myapp.com:8080 :8080 swarm-wide ingress port Manager (8080) for myapp • Every node listens on 8080 • Container-aware routing mesh can transparently reroute :8080 :8080 :8080 traffic from Worker3 to a node Worker 1 Worker 2 Worker 3 that is running container • Built in load balancing into the Engine frontend frontend frontend • DNS-based service discovery $ docker service create --replicas 3 --name frontend --network mynet -p 8080:80 frontend_image:latest

  24. Security out of the box Cryptographic Node Identity ○ Workload segregation (think PCI) There is no “insecure mode”: ○ TLS mutual auth ○ TLS encryption ○ Certificate rotation

  25. Container Health Check in Dockerfile HEALTHCHECK --interval=5m --timeout=3s --retries 3 CMD curl -f http://localhost/ || exit 1 Checks every 5 minutes that web server can return index page within 3 seconds. Three consecutive failures puts container in an unhealthy state.

  26. Orchestration Deep Dive + demo at the end Victor Vieux / vieux@docker.com / gh: vieux

  27. Swarm Topology Node Node Node Node Node Node Node Node Node Node Node Node

  28. Swarm Topology Node Node Node Node Node Node Node Node Node Node Node Node Manager Worker

  29. Swarm Topology Node ● Each Node has a role ● Roles are dynamic Node ● Programmable Topology Node Node Node Node Node Node Node Node Node Node Manager Worker

  30. Docker swarm mode communication internals Raft consensus group Internal Distributed State Store Manager Manager Manager gRPC Worker Worker Worker Worker Worker Worker Worker Gossip network

  31. Quorum Layer Raft consensus group Internal Distributed State Store Manager Manager Manager ● Strongly consistent: Holds desired state ● Simple to operate ● Blazing fast (in-memory reads, domain specific indexing, ...) ● Secure

  32. Worker-to-Worker Gossip Worker Worker Worker Worker Worker Worker Worker Gossip network ● Eventually consistent: Routing mesh, load balancing rules, ... ● High volume, p2p network between workers ● Secure: Symmetric encryption with key rotation in Raft

  33. Node Breakdown docker service create Accepts command from client and creates service object API Orchestrator R Reconciliation loop for service objects and creates tasks Manager A Allocator Node Allocates IP addresses to tasks F T Scheduler Assigns nodes to tasks Checks in on workers Dispatcher Connects to dispatcher to check on assigned tasks Worker Worker Executor Executes the tasks assigned to worker node Node

  34. Internal Load Balancer

  35. Ingress Load Balancer

  36. Secure by default with end-to-end encryption Cryptographic node • identity Manager Node Manager Node Manager Node Automatic encryption • TLS TLS TLS and mutual auth (TLS) Certificate Certificate Certificate Automatic c ert rotation • Authority Authority Authority External CA • integration Worker Worker Worker TLS TLS TLS

  37. DEMO

  38. Questions? Victor Vieux Mike Goelzer vieux@docker.com / @vieux mgoelzer@docker.com / @mgoelzer

  39. Victor Vieux Mike Goelzer vieux@docker.com / @vieux mgoelzer@docker.com / @mgoelzer

Recommend


More recommend