Kubernetes Deployment Diagram

This sample shows how a small online shop runs on a Kubernetes cluster: which machines (nodes) exist, which pods land on each node, how Services and the ingress controller route traffic to them, and where configuration and storage come from. It is drawn as a UML deployment diagram adapted to Kubernetes: 3D boxes are nodes, rounded boxes inside them are the things deployed there.


1. The diagram

Kubernetes cluster: shop application Client Cloud LB (L4) 1 Kubernetes cluster, namespace: shop «node» control plane kube-apiserver etcd kube-scheduler controller-mgr Ingress shop.example.com ConfigMap app-config Secret db-credentials «node» worker-1 kubelet, kube-proxy «node» worker-2 kubelet, kube-proxy Services (virtual IPs) ingress-nginx Pod, controller web-1 Pod, nginx :80 web-2 Pod, nginx :80 api-1 Pod, api :8080 api-2 Pod, api :8080 postgres-0 StatefulSet pod :5432 PVC 20 GiB data-postgres-0 svc web ClusterIP :80 svc api ClusterIP :8080 svc postgres headless 2 3 4 5
  1. Entry. The client resolves shop.example.com and reaches a cloud load balancer created by a Service of type LoadBalancer.
  2. Ingress controller. The load balancer forwards to the ingress-nginx pod, which reads the Ingress object (dashed, left) for host and path rules and terminates TLS.
  3. Service web. Requests go to the web Service, a stable virtual IP that kube-proxy spreads across the matching pods on both workers.
  4. Service api. Web pods call the api Service on port 8080. API pods receive settings from the ConfigMap and database credentials from the Secret, as environment variables or mounted files.
  5. Database. API pods connect through the headless postgres Service to postgres-0, a StatefulSet pod with a stable name and its own PersistentVolumeClaim, so its data survives restarts.

The control plane (API server, etcd, scheduler, controller manager) decides placement but carries no application traffic, which is why no request arrow touches it.

2. How to read it

Notation used on this page «node» machine or VM Pod running containers svc name Service, virtual IP API object config, mounted Stateful / entry needs extra care network traffic mounted as env or files 1 step in the walkthrough

Read it from outside in: cluster, then nodes, then pods. Services sit between the nodes because they belong to no single machine. Any pod drawn only once (here ingress-nginx and postgres-0) is a single point of failure worth questioning.

3. Variant: strict UML notation

Variant: the same system in strict UML 2.5 deployment notation «device» cloud load balancer «artifact» lb-config.yaml «device» worker node «executionEnvironment» containerd «artifact» web:1.27 OCI image «artifact» api:2.4.1 OCI image «device» db node «executionEnv» PostgreSQL 16 «artifact» shop schema «HTTPS» «TCP» 5432 Solid lines are communication paths; stereotypes in guillemets name the kind of element.

The same system with no Kubernetes vocabulary at all: «device» nodes, an «executionEnvironment» (the container runtime or the database server) and «artifact» elements for what is deployed. This version suits audiences outside the platform team and survives a move to another orchestrator, at the cost of hiding Services and replicas.

4. Pros, cons, and when to use

Pros

Cons

When to use

When not to use

5. Diagrams-as-code

A Mermaid flowchart with subgraphs for nodes is the quickest way to keep this in a repository:

flowchart LR
  client([Client]) --> lb[Cloud LB]
  subgraph cluster[Kubernetes cluster - namespace shop]
    subgraph w1[node worker-1]
      ing[ingress-nginx pod]
      web1[web-1 pod]
      api1[api-1 pod]
    end
    subgraph w2[node worker-2]
      web2[web-2 pod]
      api2[api-2 pod]
      pg[(postgres-0)]
    end
    svcweb{{svc web}}
    svcapi{{svc api}}
    svcpg{{svc postgres headless}}
    cm[/ConfigMap app-config/]
    sec[/Secret db-credentials/]
  end
  lb --> ing --> svcweb
  svcweb --> web1 & web2
  web1 --> svcapi --> api1 & api2
  api1 --> svcpg --> pg
  cm -.-> api1
  sec -.-> api1
  pg -.- pvc[(PVC 20 GiB)]