Docker Swarm Classic

Revision as of 21:34, 5 July 2018 by Adam (talk | contribs) (Introduction)

Revision as of 21:34, 5 July 2018 by Adam (talk | contribs) (Introduction)

<< Back to Orchestration main


WarningIcon.png

Warning
Minden amit itt leírok már elavult. A swarm 1.0, vagy swarm classic helyét már átvette a swarm mode. Viszont fontos tudni, hogy mi tartozik a swarm classic-ba és a swarm mode-ba, mivel ezek folyton keveredő fogalmak a fórumokon, fontos tisztán látni.


Contents

Introduction

https://docs.docker.com/swarm/reference/manage/


There are two main options for creating swarm classic cluster.

  1. We create the physical or virtual environment, and install docker manually. Then the nodes must be added to the cluster also manually.
  2. We use the docker-machine command with the --swarm options to create new VMs that are part of the swarm cluster out of the box.


Bármelyik megoldást is választjuk a swarm cluster létrehozására, szükség van egy discovery szolgáltatóra, ahova a node-ok regisztrálják magukat. A master a discovery szolgáltatót folyamatosan poll-ozza, hogy hozzájusson az aktuális member listához.

ImportantIcon.png

Note
Ez a swarm mode-ban (swarm 2.0) már nincs így. Discovery service nélkül is képes a master megtalálni a node-okat.


Két discovery szolgáltatásra térnék ki.
Forrás1: https://docs.docker.com/swarm/discovery/#docker-hub-as-a-hosted-discovery-service
Forrás2: https://docs.docker.com/swarm/reference/manage/

  • token: A DockerHub által nyújtott, ingyenes discovery szolgáltatás. Produkciós környezetbe nagyon nem ajánlott.
  • consul: A Consul egy ingyenes, lokálisan futó discovery szolgáltatás, ezt írja magáról: "Consul is a distributed service mesh to connect, secure, and configure services across any runtime platform and public or private cloud Service registry, integrated health checks, and DNS and HTTP interfaces enable any service to discover and be discovered by other services"

Swarm cluster DockerHub discovery service használatával

Swarm cluster 'Consul' használatával

Cluster vizsgálata

# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                    NAMES
4d6e01c1b7ce        swarm:latest        "/swarm join --adver…"   6 minutes ago       Up 6 minutes        2375/tcp                                 worker1/swarm-agent
116582ce7e0c        swarm:latest        "/swarm join --adver…"   9 minutes ago       Up 9 minutes        2375/tcp                                 swarm-master/swarm-agent
88440d8e5e1b        swarm:latest        "/swarm manage --tls…"   9 minutes ago       Up 9 minutes        2375/tcp, 192.168.42.35:3376->3376/tcp   swarm-master/swarm-agent-master


# docker info
Containers: 3
 Running: 3
 Paused: 0
 Stopped: 0
Images: 2
Server Version: swarm/1.2.9
Role: primary
Strategy: spread
Filters: health, port, containerslots, dependency, affinity, constraint, whitelist
Nodes: 2
 swarm-master: 192.168.42.35:2376
  └ ID: UVDV:W5VI:NRDU:25KM:43GY:2ZL6:AIBL:TKKL:ASEG:JSMM:6DI5:NLLN|192.168.42.35:2376
  └ Status: Healthy
  └ Containers: 2 (2 Running, 0 Paused, 0 Stopped)
  └ Reserved CPUs: 0 / 1
  └ Reserved Memory: 0 B / 1.021 GiB
  └ Labels: kernelversion=4.9.93-boot2docker, operatingsystem=Boot2Docker
  └ UpdatedAt: 2018-07-04T20:45:47Z
  └ ServerVersion: 18.05.0-ce
 worker1: 192.168.42.181:2376
  └ ID: SMB3:EZOK:OZJ7:22W6:3PBB:ZLCF:BUFA:VYMU:PLH5:RWBT:2E7D:GAOT|192.168.42.181:2376
  └ Status: Healthy
  └ Containers: 1 (1 Running, 0 Paused, 0 Stopped)
  └ Reserved CPUs: 0 / 1
  └ Reserved Memory: 0 B / 1.021 GiB
  └ Labels: kernelversion=4.9.93-boot2docker,

Swarm létrehozása docker-machine-al

WarningIcon.png

Warning
A docker-machine paranccsal csak swarm classic cluster-t tudunk natívan építeni, swarm mode cluster-t nem tud létrehozni a VM legyártásakor, kivéve ha a driver ezt lehetővé teszi. Tehát a docker-machine parancs --swarm kapcsolója kizárólag swarm classic-hoz jó. Pl. az Amazon diver támogatja a swarm mode cluster létrehozását a VM legyártása közben.