# virtualelephant/k8s-sample-application architecture

> Architecture diagram of the GitHub repository virtualelephant/k8s-sample-application, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/virtualelephant/k8s-sample-application
- Repository: https://github.com/virtualelephant/k8s-sample-application

## Overview

This Kubernetes sample demonstrates a log-message pipeline: publisher containers send messages to RabbitMQ, a reader consumes them and updates shared HTML, and NGINX serves that page to users. The manifests also describe RabbitMQ and frontend exposure, shared persistent storage, and two publisher variants. Relationship evidence comes from the README and the sampled publisher/reader code; unsampled manifests limit confidence about exact Kubernetes wiring.

Main entry points: [`rabbitmq-prod.yaml`](https://github.com/virtualelephant/k8s-sample-application/blob/main/rabbitmq-prod.yaml) (RabbitMQ service), [`publisher-container-az1/publisher.py`](https://github.com/virtualelephant/k8s-sample-application/blob/main/publisher-container-az1/publisher.py) (AZ1 publisher), [`reader-container/reader.py`](https://github.com/virtualelephant/k8s-sample-application/blob/main/reader-container/reader.py) (Message reader), [`frontend.yaml`](https://github.com/virtualelephant/k8s-sample-application/blob/main/frontend.yaml) (NGINX frontend)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_messaging["Messaging"]
  node_queue["Log queue<br/>[rabbitmq-prod.yaml]"]
  node_rabbitmq["RabbitMQ service<br/>[rabbitmq-prod.yaml]"]
end

subgraph group_producers["Message producers"]
  node_az1["AZ1 publisher<br/>[publisher.py]"]
  node_az2["AZ2 publisher<br/>[publisher.py]"]
  node_prometheus["Prometheus metrics endpoint<br/>[publisher.py]"]
end

subgraph group_presentation["Log presentation"]
  node_reader["Message reader<br/>[reader.py]"]
  node_sharedhtml[("Shared HTML storage")]
  node_htmltemplate["HTML template"]
  node_nginx["NGINX frontend<br/>[frontend.yaml]"]
  node_nginxconfig["NGINX server config<br/>[nginx.conf]"]
end

subgraph group_deployment["Kubernetes exposure"]
  node_frontendroute["Frontend access route"]
  node_rabbitroute["RabbitMQ access route"]
end

node_user(("Browser user"))

node_az1 -->|"connects to"| node_rabbitmq
node_az1 -->|"publishes messages"| node_queue
node_az2 -->|"connects to"| node_rabbitmq
node_az2 -->|"publishes messages"| node_queue
node_reader -->|"connects to"| node_rabbitmq
node_reader -->|"consumes messages"| node_queue
node_reader -->|"updates HTML"| node_sharedhtml
node_htmltemplate -->|"initializes page"| node_sharedhtml
node_nginx -->|"serves page"| node_sharedhtml
node_nginxconfig -.->|"configures"| node_nginx
node_user -->|"requests page"| node_frontendroute
node_frontendroute -->|"routes traffic"| node_nginx
node_rabbitroute -->|"exposes HTTP"| node_rabbitmq
node_az1 -->|"exposes metrics"| node_prometheus

click node_az1 "https://github.com/virtualelephant/k8s-sample-application/blob/main/publisher-container-az1/publisher.py"
click node_az2 "https://github.com/virtualelephant/k8s-sample-application/blob/main/publisher-container-az2/publisher.py"
click node_queue "https://github.com/virtualelephant/k8s-sample-application/blob/main/rabbitmq-prod.yaml"
click node_rabbitmq "https://github.com/virtualelephant/k8s-sample-application/blob/main/rabbitmq-prod.yaml"
click node_reader "https://github.com/virtualelephant/k8s-sample-application/blob/main/reader-container/reader.py"
click node_sharedhtml "https://github.com/virtualelephant/k8s-sample-application/blob/main/frontend-storage.yaml"
click node_htmltemplate "https://github.com/virtualelephant/k8s-sample-application/blob/main/html-configmap.yaml"
click node_nginx "https://github.com/virtualelephant/k8s-sample-application/blob/main/frontend.yaml"
click node_nginxconfig "https://github.com/virtualelephant/k8s-sample-application/blob/main/nginx-container/nginx.conf"
click node_frontendroute "https://github.com/virtualelephant/k8s-sample-application/blob/main/frontend-httpproxy.yaml"
click node_rabbitroute "https://github.com/virtualelephant/k8s-sample-application/blob/main/rabbitmq-httpproxy.yaml"
click node_prometheus "https://github.com/virtualelephant/k8s-sample-application/blob/main/publisher-container-az1/publisher.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_queue,node_rabbitmq,node_user toneBlue
class node_az1,node_az2,node_prometheus toneAmber
class node_reader,node_sharedhtml,node_htmltemplate,node_nginx,node_nginxconfig toneMint
class node_frontendroute,node_rabbitroute toneRose
```

## Components

### Messaging

- [Log queue](https://github.com/virtualelephant/k8s-sample-application/blob/main/rabbitmq-prod.yaml): `rabbitmq-prod.yaml`
- [RabbitMQ service](https://github.com/virtualelephant/k8s-sample-application/blob/main/rabbitmq-prod.yaml): `rabbitmq-prod.yaml`

### Message producers

- [AZ1 publisher](https://github.com/virtualelephant/k8s-sample-application/blob/main/publisher-container-az1/publisher.py): `publisher-container-az1/publisher.py`
- [AZ2 publisher](https://github.com/virtualelephant/k8s-sample-application/blob/main/publisher-container-az2/publisher.py): `publisher-container-az2/publisher.py`
- [Prometheus metrics endpoint](https://github.com/virtualelephant/k8s-sample-application/blob/main/publisher-container-az1/publisher.py): `publisher-container-az1/publisher.py`

### Log presentation

- [Message reader](https://github.com/virtualelephant/k8s-sample-application/blob/main/reader-container/reader.py): `reader-container/reader.py`
- [Shared HTML storage](https://github.com/virtualelephant/k8s-sample-application/blob/main/frontend-storage.yaml): `frontend-storage.yaml`
- [HTML template](https://github.com/virtualelephant/k8s-sample-application/blob/main/html-configmap.yaml): `html-configmap.yaml`
- [NGINX frontend](https://github.com/virtualelephant/k8s-sample-application/blob/main/frontend.yaml): `frontend.yaml`
- [NGINX server config](https://github.com/virtualelephant/k8s-sample-application/blob/main/nginx-container/nginx.conf): `nginx-container/nginx.conf`

### Kubernetes exposure

- [Frontend access route](https://github.com/virtualelephant/k8s-sample-application/blob/main/frontend-httpproxy.yaml): `frontend-httpproxy.yaml`
- [RabbitMQ access route](https://github.com/virtualelephant/k8s-sample-application/blob/main/rabbitmq-httpproxy.yaml): `rabbitmq-httpproxy.yaml`

### Other components

- **Browser user**

## Connections

- AZ1 publisher → RabbitMQ service: connects to (evidence: `publisher-container-az1/publisher.py`)
- AZ1 publisher → Log queue: publishes messages (evidence: `publisher-container-az1/publisher.py`)
- AZ2 publisher → RabbitMQ service: connects to (evidence: `publisher-container-az2/publisher.py`)
- AZ2 publisher → Log queue: publishes messages (evidence: `publisher-container-az2/publisher.py`)
- Message reader → RabbitMQ service: connects to (evidence: `reader-container/reader.py`)
- Message reader → Log queue: consumes messages (evidence: `reader-container/reader.py`)
- Message reader → Shared HTML storage: updates HTML (evidence: `reader-container/reader.py`)
- HTML template → Shared HTML storage: initializes page (evidence: `README.md`)
- NGINX frontend → Shared HTML storage: serves page (evidence: `README.md`)
- NGINX server config → NGINX frontend: configures
- Browser user → Frontend access route: requests page (evidence: `README.md`)
- Frontend access route → NGINX frontend: routes traffic (evidence: `README.md`)
- RabbitMQ access route → RabbitMQ service: exposes HTTP (evidence: `README.md`)
- AZ1 publisher → Prometheus metrics endpoint: exposes metrics (evidence: `publisher-container-az1/publisher.py`)
