# aps31012005-prog/task14_kubernetes_scaling_rolling_updates architecture

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

- Interactive diagram: https://gitdiagram.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates
- Repository: https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates

## Overview

This repository demonstrates a CIFAR-10 image-classification application deployed on Kubernetes. The user uploads an image in Streamlit, which sends it to the Flask prediction API; the API preprocesses it and invokes the CNN model. Separately, an operator manages replicas and rolling updates, then checks availability and resource use. The application flow is visible in the sampled Python files; Kubernetes scaling and monitoring capabilities are documented in the README, but the manifest contents were not sampled.

Main entry points: [`flask-deployment.yaml`](https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/flask-deployment.yaml) (Flask Deployment), [`README.md`](https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/README.md) (Availability Checks), [`app.py`](https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/app.py) (Streamlit UI), [`flask_api.py`](https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/flask_api.py) (Flask API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_streamlit["Streamlit UI<br/>[app.py]"]
end

subgraph group_prediction["Prediction Backend"]
  node_flask_api["Flask API<br/>[flask_api.py]"]
  node_cnn[("CIFAR-10 CNN<br/>[cifar10_cnn.keras]")]
end

subgraph group_kubernetes["Kubernetes Runtime"]
  node_flask_deploy["Flask Deployment"]
  node_flask_service["Flask Service<br/>[flask-service.yaml]"]
  node_streamlit_deploy["Streamlit Deployment"]
  node_streamlit_service["Streamlit Service"]
end

subgraph group_operations["Cluster Operations"]
  node_kube["Kubernetes Cluster"]
  node_scaling["Replica Scaling<br/>[README.md]"]
  node_rollout["Rolling Updates<br/>[README.md]"]
  node_monitoring["Resource Monitoring<br/>[README.md]"]
  node_metrics["Metrics Server"]
  node_availability["Availability Checks<br/>[README.md]"]
end

node_user(("Image Uploader"))
node_operator(("Cluster Operator"))

node_user -->|"uploads image"| node_streamlit
node_streamlit -->|"posts image"| node_flask_api
node_flask_api -->|"predicts with"| node_cnn
node_operator -->|"scales replicas"| node_scaling
node_operator -->|"applies update"| node_rollout
node_operator -->|"checks usage"| node_monitoring
node_operator -->|"verifies service"| node_availability
node_scaling -->|"changes replicas"| node_flask_deploy
node_rollout -->|"updates deployment"| node_flask_deploy
node_flask_deploy -->|"runs in"| node_kube
node_streamlit_deploy -->|"runs in"| node_kube
node_flask_service -.->|"routes to pods"| node_flask_deploy
node_streamlit_service -.->|"routes to pods"| node_streamlit_deploy
node_monitoring -->|"uses metrics"| node_metrics
node_availability -->|"checks access"| node_flask_service
node_availability -->|"checks access"| node_streamlit_service

click node_streamlit "https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/app.py"
click node_flask_api "https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/flask_api.py"
click node_cnn "https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/model/cifar10_cnn.keras"
click node_flask_deploy "https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/flask-deployment.yaml"
click node_flask_service "https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/flask-service.yaml"
click node_streamlit_deploy "https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/streamlit-deployment.yaml"
click node_streamlit_service "https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/streamlit-service.yaml"
click node_scaling "https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/README.md"
click node_rollout "https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/README.md"
click node_monitoring "https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/README.md"
click node_availability "https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/README.md"

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_streamlit toneBlue
class node_flask_api,node_cnn toneAmber
class node_flask_deploy,node_flask_service,node_streamlit_deploy,node_streamlit_service toneMint
class node_kube,node_scaling,node_rollout,node_monitoring,node_metrics,node_availability toneRose
class node_user,node_operator toneIndigo
```

## Components

### Frontend

- [Streamlit UI](https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/app.py): `app.py`

### Prediction Backend

- [Flask API](https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/flask_api.py): `flask_api.py`
- [CIFAR-10 CNN](https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/model/cifar10_cnn.keras): `model/cifar10_cnn.keras`

### Kubernetes Runtime

- [Flask Deployment](https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/flask-deployment.yaml): `flask-deployment.yaml`
- [Flask Service](https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/flask-service.yaml): `flask-service.yaml`
- [Streamlit Deployment](https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/streamlit-deployment.yaml): `streamlit-deployment.yaml`
- [Streamlit Service](https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/streamlit-service.yaml): `streamlit-service.yaml`

### Cluster Operations

- **Kubernetes Cluster**
- [Replica Scaling](https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/README.md): `README.md`
- [Rolling Updates](https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/README.md): `README.md`
- [Resource Monitoring](https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/README.md): `README.md`
- **Metrics Server**
- [Availability Checks](https://github.com/aps31012005-prog/task14_kubernetes_scaling_rolling_updates/blob/main/README.md): `README.md`

### Other components

- **Image Uploader**
- **Cluster Operator**

## Connections

- Image Uploader → Streamlit UI: uploads image (evidence: `app.py`)
- Streamlit UI → Flask API: posts image (evidence: `app.py`)
- Flask API → CIFAR-10 CNN: predicts with (evidence: `flask_api.py`)
- Cluster Operator → Replica Scaling: scales replicas (evidence: `README.md`)
- Cluster Operator → Rolling Updates: applies update (evidence: `README.md`)
- Cluster Operator → Resource Monitoring: checks usage (evidence: `README.md`)
- Cluster Operator → Availability Checks: verifies service (evidence: `README.md`)
- Replica Scaling → Flask Deployment: changes replicas (evidence: `README.md`)
- Rolling Updates → Flask Deployment: updates deployment (evidence: `README.md`)
- Flask Deployment → Kubernetes Cluster: runs in (evidence: `README.md`)
- Streamlit Deployment → Kubernetes Cluster: runs in (evidence: `README.md`)
- Flask Service → Flask Deployment: routes to pods
- Streamlit Service → Streamlit Deployment: routes to pods
- Resource Monitoring → Metrics Server: uses metrics (evidence: `README.md`)
- Availability Checks → Flask Service: checks access (evidence: `README.md`)
- Availability Checks → Streamlit Service: checks access (evidence: `README.md`)
