Príklady diagramov nasadenia
Tri diagramy nasadenia systémov, ktoré poznáte - trojvrstvová webová aplikácia, Kubernetes klaster a pool za load balancerom - vždy s odôvodnením, čo bolo nakreslené a čo zámerne vynechané.
8 min čítaniaUML 2.5.122 z 35
01Example 1: a three-tier web application
The diagram above is the one worth being able to draw from memory. A browser, a web server terminating TLS, an application server, a database. Three communication paths carrying the protocol and port, and three artifacts dropped onto the nodes that run them.
Two decisions in it are worth naming. First, the protocol labels are the reason the diagram is useful: HTTPS, HTTP/8080, TCP/5432 is the entire content of most security reviews, and a diagram without them is four boxes anybody could have guessed. Second, the artifacts are real filenames - orders.jar, not “application” - because a deployment diagram is about physical things, and a build produces files with names.
02Example 2: a Kubernetes cluster
Containers make people hesitate, because a container is both a thing that runs and a thing that was built. UML already separates those: the running container is an execution environment, which is a node, and the image it started from is an artifact, which is deployed onto it.
Nothing about the shape of this diagram differs from the three-tier one, which is the point: the runtime changed and the notation did not. The load balancer is a «device» because it is infrastructure you do not deploy into. The ingress controller and the pod are «execution environment» because other things run inside them. The image tag orders:1.4.2is an artifact because a build produced it, and putting the version in the label is what makes the diagram answer “what is running in production right now”.
The managed database sits at the edge as a plain device. That is the honest drawing: you do not deploy artifacts onto a service somebody else operates, and pretending the schema is installed “onto RDS” is only true in the sense that it was applied there once.
03Example 3: a load-balanced pool
The commonest reason anyone opens a deployment diagram is to find out what happens when one box dies. That question has a shape, and it is worth drawing explicitly rather than leaving it to a footnote.
Three application nodes behind one load balancer, all writing to a single primary. Drawn this way, the single point of failure is visible without anybody having to say it: the app tier fans out and the data tier does not. That is a sentence somebody will act on, and it took no extra notation to make.
When the count varies at runtime, replace the three nodes with one carrying a multiplicity - app-node [3..*] - rather than drawing an arbitrary number. A diagram that claims exactly three is false the first time the group scales, and a diagram known to be false stops being consulted.
04What to leave off
Every deployment diagram that becomes useless does so the same way: somebody kept adding nodes. The discipline is deciding what the diagram is for before the second box goes down.
Reach for it when
- Protocols and ports on every communication path - it is the content of most reviews.
- Real artifact names with versions, so the diagram answers what is running now.
- One representative instance per role, with a multiplicity when the count varies.
- Managed services as plain devices at the edge, with the boundary of what you operate visible.
Reach for something else when
- Logical layers - they have no address and nothing is deployed onto them.
- Every microservice in a large estate. Draw one subsystem per diagram instead.
- Monitoring, logging and CI agents, unless the diagram is about them.
- Live instance counts, which are wrong by the time the diagram is reviewed.
If you need the counterpart that shows the software rather than the machines, that is a component diagram. The two are usually drawn as a pair, and the deployment one is the shorter of them.
05What to remember
In one line each
- 01Four nodes, labelled protocols and named artifacts is already a complete deployment diagram.
- 02A running container is a node; the image it started from is an artifact. Confusing the two is the usual container mistake.
- 03Protocol and port labels are what make the diagram worth opening in a review.
- 04Draw one instance per role and use a multiplicity when the count varies at runtime.
- 05If a box cannot be pinged, it does not belong on this diagram.
06Časté otázky
Aký je jednoduchý príklad diagramu nasadenia?
Prehliadač sa pripája na webový server, ten na aplikačný server a ten na databázu, pričom na každom je nasadený jeden artefakt. Štyri uzly, tri komunikačné cesty označené protokolom a tri šípky nasadenia sú úplný a užitočný diagram.
Ako nakresliť diagram nasadenia pre Kubernetes?
Behové časti klastra modelujte ako uzly a obrazy ako artefakty. Load balancer je zariadenie, ingress kontrolér a každý pod sú behové prostredia a obraz kontajnera je artefakt nasadený na pod. Spravované služby ako hostovaná databáza zostávajú zariadeniami na okraji diagramu.
Sú kontajnery v UML uzly alebo artefakty?
Oboje, podľa toho, ktorý kontajner myslíte. Bežiaci kontajner je behové prostredie, teda uzol, lebo v ňom beží niečo ďalšie. Obraz, z ktorého bol spustený, je artefakt, lebo je to súbor z buildu. Kresliť obraz ako uzol je najčastejšia chyba na kontajnerovom diagrame.
Ako zobraziť redundanciu na diagrame nasadenia?
Buď nakreslite jednotlivé inštancie, čo je poctivé, ale nefunguje nad štyri, alebo nakreslite jeden uzol s násobnosťou v rohu, napríklad app-node s 3..*. Druhú možnosť použite, keď sa počet mení za behu - diagram tvrdiaci presne tri je nesprávny hneď po prvom autoškálovaní.
Koľko detailu patrí na diagram nasadenia?
Toľko, aby odpovedal na otázku, kvôli ktorej vznikol. Infraštruktúrny prehľad chce protokoly a porty na komunikačných cestách; onboarding diagram chce štyri boxy a nič viac. Každý ďalší uzol je tvrdenie, ktoré musí niekto po ďalšej migrácii udržať pravdivé.
Súvisiace články