# masungil70/docker-kubernetes architecture

> Architecture diagram of the GitHub repository masungil70/docker-kubernetes, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/masungil70/docker-kubernetes
- Repository: https://github.com/masungil70/docker-kubernetes

## Overview

This repository is a collection of hands-on container and Kubernetes examples, not one integrated application. Its principal request-to-result patterns are small HTTP services, including database-backed item APIs; separate examples demonstrate container orchestration, custom controllers, scheduling, deployment, and observability. The graph groups these independent demonstrations by purpose. Only sampled code and explicit source-index references support solid edges; unsampled examples are represented as components without inferred runtime connections.

Main entry points: [`chapter13/step7/api/main.py`](https://github.com/masungil70/docker-kubernetes/blob/main/chapter13/step7/api/main.py) (Read/write item API), [`chapter12/step3/appdeploy_controller/backend/appdeploy_controller.py`](https://github.com/masungil70/docker-kubernetes/blob/main/chapter12/step3/appdeploy_controller/backend/appdeploy_controller.py) (App deployment controller), [`chapter13/step8/api/main.py`](https://github.com/masungil70/docker-kubernetes/blob/main/chapter13/step8/api/main.py) (Galera item API), [`chapter4/compose/stack/step8/backend/main.py`](https://github.com/masungil70/docker-kubernetes/blob/main/chapter4/compose/stack/step8/backend/main.py) (Compose item API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP service examples"]
  node_basic_echo["Echo services"]
  node_whoami["Request inspector<br/>[main.py]"]
  node_echo_config["Configured echo<br/>[main.py]"]
  node_calculator["Calculator API<br/>[main.py]"]
  node_load_examples["Load-balancer demos<br/>[main.py]"]
end

subgraph group_data["Database-backed APIs"]
  node_item_split["Read/write item API<br/>[main.py]"]
  node_item_galera["Galera item API<br/>[main.py]"]
  node_compose_api["Compose item API<br/>[main.py]"]
  node_db_primary[("MariaDB primary")]
  node_db_replicas[("MariaDB replicas")]
  node_db_galera[("MariaDB Galera")]
end

subgraph group_orchestration["Container orchestration"]
  node_compose_examples["Compose examples"]
end

subgraph group_kubernetes["Kubernetes extensions"]
  node_pod_list["Pod listing"]
  node_custom_scheduler["Custom scheduler<br/>[__main__.py]"]
  node_greeting_controller["Greeting controller"]
  node_appdeploy_controller["App deployment controller"]
  node_helm_apps["Helm app examples"]
  node_argocd_echo["Argo CD echo app<br/>[main.py]"]
end

subgraph group_operations["Operations and metrics"]
  node_cadvisor_app["CPU-load demo<br/>[main.py]"]
  node_metrics_calculator["Instrumented calculator<br/>[main.py]"]
end

node_client(("HTTP client"))
node_kube_api{{"Kubernetes API"}}
node_managed_resources["Deployment, Service, HPA"]
node_prometheus{{"Prometheus metrics endpoint"}}

node_client -->|"requests"| node_basic_echo
node_client -->|"requests"| node_whoami
node_client -->|"requests"| node_echo_config
node_client -->|"calculates"| node_calculator
node_client -->|"manages items"| node_item_split
node_client -->|"manages items"| node_item_galera
node_client -->|"manages items"| node_compose_api
node_client -.->|"requests"| node_load_examples
node_client -->|"requests"| node_cadvisor_app
node_client -->|"requests"| node_metrics_calculator
node_item_split -->|"writes"| node_db_primary
node_item_split -->|"reads"| node_db_replicas
node_item_galera -->|"reads and writes"| node_db_galera
node_compose_api -->|"reads and writes"| node_db_primary
node_greeting_controller -->|"watches events"| node_kube_api
node_appdeploy_controller -->|"creates and deletes"| node_kube_api
node_appdeploy_controller -->|"manages"| node_managed_resources
node_metrics_calculator -->|"exposes metrics"| node_prometheus
node_pod_list -.->|"queries"| node_kube_api
node_custom_scheduler -.->|"schedules pods"| node_kube_api
node_helm_apps -.->|"deploys"| node_kube_api
node_argocd_echo -.->|"deploys"| node_kube_api
node_compose_examples -.->|"orchestrates services"| node_db_primary

click node_basic_echo "https://github.com/masungil70/docker-kubernetes/tree/main/chapter6"
click node_whoami "https://github.com/masungil70/docker-kubernetes/blob/main/chapter3/exam/load-balancer/main.py"
click node_echo_config "https://github.com/masungil70/docker-kubernetes/blob/main/chapter8/8.1/backend/main.py"
click node_calculator "https://github.com/masungil70/docker-kubernetes/blob/main/chapter14/fastapi_calculator/main.py"
click node_load_examples "https://github.com/masungil70/docker-kubernetes/blob/main/chapter2/exam/load-balancer-fastapi/app/main.py"
click node_item_split "https://github.com/masungil70/docker-kubernetes/blob/main/chapter13/step7/api/main.py"
click node_item_galera "https://github.com/masungil70/docker-kubernetes/blob/main/chapter13/step8/api/main.py"
click node_compose_api "https://github.com/masungil70/docker-kubernetes/blob/main/chapter4/compose/stack/step8/backend/main.py"
click node_compose_examples "https://github.com/masungil70/docker-kubernetes/tree/main/chapter4/compose"
click node_pod_list "https://github.com/masungil70/docker-kubernetes/blob/main/chapter10/list-service-and-pod.py"
click node_custom_scheduler "https://github.com/masungil70/docker-kubernetes/blob/main/chapter11-2/custom-scheduler-python/__main__.py"
click node_greeting_controller "https://github.com/masungil70/docker-kubernetes/blob/main/chapter12/step2/greeting_controller/backend/greeting_controller.py"
click node_appdeploy_controller "https://github.com/masungil70/docker-kubernetes/blob/main/chapter12/step3/appdeploy_controller/backend/appdeploy_controller.py"
click node_helm_apps "https://github.com/masungil70/docker-kubernetes/tree/main/chapter14/helm"
click node_argocd_echo "https://github.com/masungil70/docker-kubernetes/blob/main/chapter14/ArgoCD/echo-hostname/main.py"
click node_cadvisor_app "https://github.com/masungil70/docker-kubernetes/blob/main/chapter14/cadvisor/main.py"
click node_metrics_calculator "https://github.com/masungil70/docker-kubernetes/blob/main/chapter14/fastapi_calculator/main.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_basic_echo,node_whoami,node_echo_config,node_calculator,node_load_examples,node_client toneBlue
class node_item_split,node_item_galera,node_compose_api,node_db_primary,node_db_replicas,node_db_galera toneAmber
class node_compose_examples,node_kube_api toneMint
class node_pod_list,node_custom_scheduler,node_greeting_controller,node_appdeploy_controller,node_helm_apps,node_argocd_echo toneRose
class node_cadvisor_app,node_metrics_calculator,node_managed_resources,node_prometheus toneIndigo
```

## Components

### HTTP service examples

- [Echo services](https://github.com/masungil70/docker-kubernetes/tree/main/chapter6): `chapter6`
- [Request inspector](https://github.com/masungil70/docker-kubernetes/blob/main/chapter3/exam/load-balancer/main.py): `chapter3/exam/load-balancer/main.py`
- [Configured echo](https://github.com/masungil70/docker-kubernetes/blob/main/chapter8/8.1/backend/main.py): `chapter8/8.1/backend/main.py`
- [Calculator API](https://github.com/masungil70/docker-kubernetes/blob/main/chapter14/fastapi_calculator/main.py): `chapter14/fastapi_calculator/main.py`
- [Load-balancer demos](https://github.com/masungil70/docker-kubernetes/blob/main/chapter2/exam/load-balancer-fastapi/app/main.py): `chapter2/exam/load-balancer-fastapi/app/main.py`

### Database-backed APIs

- [Read/write item API](https://github.com/masungil70/docker-kubernetes/blob/main/chapter13/step7/api/main.py): `chapter13/step7/api/main.py`
- [Galera item API](https://github.com/masungil70/docker-kubernetes/blob/main/chapter13/step8/api/main.py): `chapter13/step8/api/main.py`
- [Compose item API](https://github.com/masungil70/docker-kubernetes/blob/main/chapter4/compose/stack/step8/backend/main.py): `chapter4/compose/stack/step8/backend/main.py`
- **MariaDB primary**
- **MariaDB replicas**
- **MariaDB Galera**

### Container orchestration

- [Compose examples](https://github.com/masungil70/docker-kubernetes/tree/main/chapter4/compose): `chapter4/compose`

### Kubernetes extensions

- [Pod listing](https://github.com/masungil70/docker-kubernetes/blob/main/chapter10/list-service-and-pod.py): `chapter10/list-service-and-pod.py`
- [Custom scheduler](https://github.com/masungil70/docker-kubernetes/blob/main/chapter11-2/custom-scheduler-python/__main__.py): `chapter11-2/custom-scheduler-python/__main__.py`
- [Greeting controller](https://github.com/masungil70/docker-kubernetes/blob/main/chapter12/step2/greeting_controller/backend/greeting_controller.py): `chapter12/step2/greeting_controller/backend/greeting_controller.py`
- [App deployment controller](https://github.com/masungil70/docker-kubernetes/blob/main/chapter12/step3/appdeploy_controller/backend/appdeploy_controller.py): `chapter12/step3/appdeploy_controller/backend/appdeploy_controller.py`
- [Helm app examples](https://github.com/masungil70/docker-kubernetes/tree/main/chapter14/helm): `chapter14/helm`
- [Argo CD echo app](https://github.com/masungil70/docker-kubernetes/blob/main/chapter14/ArgoCD/echo-hostname/main.py): `chapter14/ArgoCD/echo-hostname/main.py`

### Operations and metrics

- [CPU-load demo](https://github.com/masungil70/docker-kubernetes/blob/main/chapter14/cadvisor/main.py): `chapter14/cadvisor/main.py`
- [Instrumented calculator](https://github.com/masungil70/docker-kubernetes/blob/main/chapter14/fastapi_calculator/main.py): `chapter14/fastapi_calculator/main.py`

### Other components

- **HTTP client**
- **Kubernetes API**
- **Deployment, Service, HPA**
- **Prometheus metrics endpoint**

## Connections

- HTTP client → Echo services: requests (evidence: `chapter6/echo-hostname-v1/main.py`)
- HTTP client → Request inspector: requests (evidence: `chapter3/exam/load-balancer/main.py`)
- HTTP client → Configured echo: requests (evidence: `chapter8/8.1/backend/main.py`)
- HTTP client → Calculator API: calculates (evidence: `chapter14/fastapi_calculator/main.py`)
- HTTP client → Read/write item API: manages items (evidence: `chapter13/step7/api/main.py`)
- HTTP client → Galera item API: manages items (evidence: `chapter13/step8/api/main.py`)
- HTTP client → Compose item API: manages items (evidence: `chapter4/compose/stack/step8/backend/main.py`)
- HTTP client → Load-balancer demos: requests
- HTTP client → CPU-load demo: requests (evidence: `chapter14/cadvisor/main.py`)
- HTTP client → Instrumented calculator: requests (evidence: `chapter14/fastapi_calculator/main.py`)
- Read/write item API → MariaDB primary: writes (evidence: `chapter13/step7/api/main.py`)
- Read/write item API → MariaDB replicas: reads (evidence: `chapter13/step7/api/main.py`)
- Galera item API → MariaDB Galera: reads and writes (evidence: `chapter13/step8/api/main.py`)
- Compose item API → MariaDB primary: reads and writes (evidence: `chapter4/compose/stack/step8/backend/main.py`)
- Greeting controller → Kubernetes API: watches events (evidence: `chapter12/step2/greeting_controller/backend/greeting_controller.py`)
- App deployment controller → Kubernetes API: creates and deletes (evidence: `chapter12/step3/appdeploy_controller/backend/appdeploy_controller.py`)
- App deployment controller → Deployment, Service, HPA: manages (evidence: `chapter12/step3/appdeploy_controller/backend/appdeploy_controller.py`)
- Instrumented calculator → Prometheus metrics endpoint: exposes metrics (evidence: `chapter14/fastapi_calculator/main.py`)
- Pod listing → Kubernetes API: queries
- Custom scheduler → Kubernetes API: schedules pods
- Helm app examples → Kubernetes API: deploys
- Argo CD echo app → Kubernetes API: deploys
- Compose examples → MariaDB primary: orchestrates services
