# alanaziyasir/ai-on-gke architecture

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

- Interactive diagram: https://gitdiagram.com/alanaziyasir/ai-on-gke
- Repository: https://github.com/alanaziyasir/ai-on-gke

## Overview

AI on GKE is a collection of platform modules, workload examples, and operational tools rather than one application. A representative user-to-result flow is the RAG frontend: a user submits a prompt, the Flask handler retrieves matching context from Cloud SQL/pgvector, and a LangChain model call produces a response; content-safety filters are also part of this application. The README additionally describes cluster, Jupyter, and Ray platform capabilities. The graph combines those documented branches with sampled workload implementations; unsampled links are omitted or marked unverified.

Main entry points: [`applications/rag/frontend/container/main.py`](https://github.com/alanaziyasir/ai-on-gke/blob/main/applications/rag/frontend/container/main.py) (RAG web frontend), [`infrastructure`](https://github.com/alanaziyasir/ai-on-gke/tree/main/infrastructure) (GKE clusters), [`tutorials-and-examples/genAI-LLM/e2e-genai-langchain-app/src/backend/main.py`](https://github.com/alanaziyasir/ai-on-gke/blob/main/tutorials-and-examples/genAI-LLM/e2e-genai-langchain-app/src/backend/main.py) (GenAI request API), [`tutorials-and-examples/genAI-LLM/e2e-genai-langchain-app/src/backend/model.py`](https://github.com/alanaziyasir/ai-on-gke/blob/main/tutorials-and-examples/genAI-LLM/e2e-genai-langchain-app/src/backend/model.py) (Ray model deployment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_platform["GKE platform"]
  node_cluster["GKE clusters"]
  node_jupyter["JupyterHub"]
  node_rayplatform["Ray platform"]
end

subgraph group_rag["RAG application"]
  node_ragui["RAG web frontend<br/>[main.py]"]
  node_retrieval["Vector context retrieval<br/>[cloud_sql.py]"]
  node_pgvector[("Cloud SQL pgvector")]
  node_modelserver["Text generation endpoint<br/>[main.py]"]
  node_nlp["Text moderation<br/>[nlp_filter.py]"]
  node_dlp["Sensitive data filtering<br/>[dlp_filter.py]"]
  node_cloudnl["Cloud Natural Language"]
  node_clouddlp["Cloud DLP"]
end

subgraph group_provision["TPU provisioning"]
  node_webhook["Job mutation webhook"]
  node_creation["Node pool creation"]
  node_deletion["Node pool cleanup"]
  node_cloudprovider["GKE cloud provider"]
end

subgraph group_workloads["AI workloads"]
  node_genaiapi["GenAI request API<br/>[main.py]"]
  node_raymodel["Ray model deployment<br/>[model.py]"]
  node_stableui["Image prompt UI<br/>[app.py]"]
  node_stableclient["Stable Diffusion client"]
  node_modelendpoint["TPU model server"]
  node_batchtraining["Distributed batch training<br/>[mnist.py]"]
end

subgraph group_ops["Serving and tools"]
  node_imagebuilder["GKE disk image builder<br/>[imager.go]"]
  node_saxml["SAXML HTTP server<br/>[http_server.py]"]
  node_dcgm["DCGM Grafana proxy<br/>[get_proxy_url.py]"]
end

node_user(("Workload user"))

node_user -->|"submits prompt"| node_ragui
node_ragui -->|"fetches context"| node_retrieval
node_retrieval -->|"queries vectors"| node_pgvector
node_ragui -->|"invokes generation"| node_modelserver
node_ragui -->|"checks status and content"| node_nlp
node_ragui -.->|"uses filtering"| node_dlp
node_nlp -->|"moderates text"| node_cloudnl
node_dlp -->|"inspects content"| node_clouddlp
node_cluster -->|"hosts"| node_jupyter
node_cluster -->|"hosts"| node_rayplatform
node_user -->|"sends text"| node_genaiapi
node_genaiapi -->|"initializes deployment"| node_raymodel
node_genaiapi -->|"posts inference request"| node_raymodel
node_raymodel -->|"connects to Ray"| node_rayplatform
node_user -->|"enters prompt"| node_stableui
node_stableui -->|"sends inference request"| node_stableclient
node_stableclient -->|"requests prediction"| node_modelendpoint
node_webhook -.->|"mutates job spec"| node_cluster
node_creation -->|"ensures node pool"| node_cloudprovider
node_deletion -.->|"deletes node pool"| node_cloudprovider
node_batchtraining -.->|"runs workload"| node_cluster

click node_cluster "https://github.com/alanaziyasir/ai-on-gke/tree/main/infrastructure"
click node_jupyter "https://github.com/alanaziyasir/ai-on-gke/tree/main/modules/jupyter"
click node_rayplatform "https://github.com/alanaziyasir/ai-on-gke/tree/main/modules/kuberay-cluster"
click node_ragui "https://github.com/alanaziyasir/ai-on-gke/blob/main/applications/rag/frontend/container/main.py"
click node_retrieval "https://github.com/alanaziyasir/ai-on-gke/blob/main/applications/rag/frontend/container/cloud_sql/cloud_sql.py"
click node_modelserver "https://github.com/alanaziyasir/ai-on-gke/blob/main/applications/rag/frontend/container/main.py"
click node_nlp "https://github.com/alanaziyasir/ai-on-gke/blob/main/applications/rag/frontend/container/rai/nlp_filter.py"
click node_dlp "https://github.com/alanaziyasir/ai-on-gke/blob/main/applications/rag/frontend/container/rai/dlp_filter.py"
click node_webhook "https://github.com/alanaziyasir/ai-on-gke/blob/main/tpu-provisioner/admission_controller/admission_controller.py"
click node_creation "https://github.com/alanaziyasir/ai-on-gke/blob/main/tpu-provisioner/internal/controller/creation_controller.go"
click node_deletion "https://github.com/alanaziyasir/ai-on-gke/blob/main/tpu-provisioner/internal/controller/deletion_controller.go"
click node_cloudprovider "https://github.com/alanaziyasir/ai-on-gke/tree/main/tpu-provisioner/internal/cloud"
click node_genaiapi "https://github.com/alanaziyasir/ai-on-gke/blob/main/tutorials-and-examples/genAI-LLM/e2e-genai-langchain-app/src/backend/main.py"
click node_raymodel "https://github.com/alanaziyasir/ai-on-gke/blob/main/tutorials-and-examples/genAI-LLM/e2e-genai-langchain-app/src/backend/model.py"
click node_stableui "https://github.com/alanaziyasir/ai-on-gke/blob/main/tutorials-and-examples/tpu-examples/single-host-inference/jax/stable-diffusion/app.py"
click node_stableclient "https://github.com/alanaziyasir/ai-on-gke/blob/main/tutorials-and-examples/tpu-examples/single-host-inference/jax/stable-diffusion/stable_diffusion_request.py"
click node_batchtraining "https://github.com/alanaziyasir/ai-on-gke/blob/main/best-practices/gke-batch-refarch/06_jobset/mnist.py"
click node_imagebuilder "https://github.com/alanaziyasir/ai-on-gke/blob/main/tools/gke-disk-image-builder/imager.go"
click node_saxml "https://github.com/alanaziyasir/ai-on-gke/blob/main/tools/saxml-on-gke/httpserver/http_server.py"
click node_dcgm "https://github.com/alanaziyasir/ai-on-gke/blob/main/tools/dcgm-on-gke/grafana/proxy/get_proxy_url.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_cluster,node_jupyter,node_rayplatform,node_user toneBlue
class node_ragui,node_retrieval,node_pgvector,node_modelserver,node_nlp,node_dlp,node_cloudnl,node_clouddlp toneAmber
class node_webhook,node_creation,node_deletion,node_cloudprovider toneMint
class node_genaiapi,node_raymodel,node_stableui,node_stableclient,node_modelendpoint,node_batchtraining toneRose
class node_imagebuilder,node_saxml,node_dcgm toneIndigo
```

## Components

### GKE platform

- [GKE clusters](https://github.com/alanaziyasir/ai-on-gke/tree/main/infrastructure): `infrastructure`
- [JupyterHub](https://github.com/alanaziyasir/ai-on-gke/tree/main/modules/jupyter): `modules/jupyter`
- [Ray platform](https://github.com/alanaziyasir/ai-on-gke/tree/main/modules/kuberay-cluster): `modules/kuberay-cluster`

### RAG application

- [RAG web frontend](https://github.com/alanaziyasir/ai-on-gke/blob/main/applications/rag/frontend/container/main.py): `applications/rag/frontend/container/main.py`
- [Vector context retrieval](https://github.com/alanaziyasir/ai-on-gke/blob/main/applications/rag/frontend/container/cloud_sql/cloud_sql.py): `applications/rag/frontend/container/cloud_sql/cloud_sql.py`
- **Cloud SQL pgvector**
- [Text generation endpoint](https://github.com/alanaziyasir/ai-on-gke/blob/main/applications/rag/frontend/container/main.py): `applications/rag/frontend/container/main.py`
- [Text moderation](https://github.com/alanaziyasir/ai-on-gke/blob/main/applications/rag/frontend/container/rai/nlp_filter.py): `applications/rag/frontend/container/rai/nlp_filter.py`
- [Sensitive data filtering](https://github.com/alanaziyasir/ai-on-gke/blob/main/applications/rag/frontend/container/rai/dlp_filter.py): `applications/rag/frontend/container/rai/dlp_filter.py`
- **Cloud Natural Language**
- **Cloud DLP**

### TPU provisioning

- [Job mutation webhook](https://github.com/alanaziyasir/ai-on-gke/blob/main/tpu-provisioner/admission_controller/admission_controller.py): `tpu-provisioner/admission_controller/admission_controller.py`
- [Node pool creation](https://github.com/alanaziyasir/ai-on-gke/blob/main/tpu-provisioner/internal/controller/creation_controller.go): `tpu-provisioner/internal/controller/creation_controller.go`
- [Node pool cleanup](https://github.com/alanaziyasir/ai-on-gke/blob/main/tpu-provisioner/internal/controller/deletion_controller.go): `tpu-provisioner/internal/controller/deletion_controller.go`
- [GKE cloud provider](https://github.com/alanaziyasir/ai-on-gke/tree/main/tpu-provisioner/internal/cloud): `tpu-provisioner/internal/cloud`

### AI workloads

- [GenAI request API](https://github.com/alanaziyasir/ai-on-gke/blob/main/tutorials-and-examples/genAI-LLM/e2e-genai-langchain-app/src/backend/main.py): `tutorials-and-examples/genAI-LLM/e2e-genai-langchain-app/src/backend/main.py`
- [Ray model deployment](https://github.com/alanaziyasir/ai-on-gke/blob/main/tutorials-and-examples/genAI-LLM/e2e-genai-langchain-app/src/backend/model.py): `tutorials-and-examples/genAI-LLM/e2e-genai-langchain-app/src/backend/model.py`
- [Image prompt UI](https://github.com/alanaziyasir/ai-on-gke/blob/main/tutorials-and-examples/tpu-examples/single-host-inference/jax/stable-diffusion/app.py): `tutorials-and-examples/tpu-examples/single-host-inference/jax/stable-diffusion/app.py`
- [Stable Diffusion client](https://github.com/alanaziyasir/ai-on-gke/blob/main/tutorials-and-examples/tpu-examples/single-host-inference/jax/stable-diffusion/stable_diffusion_request.py): `tutorials-and-examples/tpu-examples/single-host-inference/jax/stable-diffusion/stable_diffusion_request.py`
- **TPU model server**
- [Distributed batch training](https://github.com/alanaziyasir/ai-on-gke/blob/main/best-practices/gke-batch-refarch/06_jobset/mnist.py): `best-practices/gke-batch-refarch/06_jobset/mnist.py`

### Serving and tools

- [GKE disk image builder](https://github.com/alanaziyasir/ai-on-gke/blob/main/tools/gke-disk-image-builder/imager.go): `tools/gke-disk-image-builder/imager.go`
- [SAXML HTTP server](https://github.com/alanaziyasir/ai-on-gke/blob/main/tools/saxml-on-gke/httpserver/http_server.py): `tools/saxml-on-gke/httpserver/http_server.py`
- [DCGM Grafana proxy](https://github.com/alanaziyasir/ai-on-gke/blob/main/tools/dcgm-on-gke/grafana/proxy/get_proxy_url.py): `tools/dcgm-on-gke/grafana/proxy/get_proxy_url.py`

### Other components

- **Workload user**

## Connections

- Workload user → RAG web frontend: submits prompt (evidence: `applications/rag/frontend/container/main.py`)
- RAG web frontend → Vector context retrieval: fetches context (evidence: `applications/rag/frontend/container/main.py`)
- Vector context retrieval → Cloud SQL pgvector: queries vectors (evidence: `applications/rag/frontend/container/cloud_sql/cloud_sql.py`)
- RAG web frontend → Text generation endpoint: invokes generation (evidence: `applications/rag/frontend/container/main.py`)
- RAG web frontend → Text moderation: checks status and content (evidence: `applications/rag/frontend/container/main.py`)
- RAG web frontend → Sensitive data filtering: uses filtering (evidence: `applications/rag/frontend/container/main.py`)
- Text moderation → Cloud Natural Language: moderates text (evidence: `applications/rag/frontend/container/rai/nlp_filter.py`)
- Sensitive data filtering → Cloud DLP: inspects content (evidence: `applications/rag/frontend/container/rai/dlp_filter.py`)
- GKE clusters → JupyterHub: hosts (evidence: `README.md`)
- GKE clusters → Ray platform: hosts (evidence: `README.md`)
- Workload user → GenAI request API: sends text (evidence: `tutorials-and-examples/genAI-LLM/e2e-genai-langchain-app/src/backend/main.py`)
- GenAI request API → Ray model deployment: initializes deployment (evidence: `tutorials-and-examples/genAI-LLM/e2e-genai-langchain-app/src/backend/main.py`)
- GenAI request API → Ray model deployment: posts inference request (evidence: `tutorials-and-examples/genAI-LLM/e2e-genai-langchain-app/src/backend/main.py`)
- Ray model deployment → Ray platform: connects to Ray (evidence: `tutorials-and-examples/genAI-LLM/e2e-genai-langchain-app/src/backend/model.py`)
- Workload user → Image prompt UI: enters prompt (evidence: `tutorials-and-examples/tpu-examples/single-host-inference/jax/stable-diffusion/app.py`)
- Image prompt UI → Stable Diffusion client: sends inference request (evidence: `tutorials-and-examples/tpu-examples/single-host-inference/jax/stable-diffusion/app.py`)
- Stable Diffusion client → TPU model server: requests prediction (evidence: `tutorials-and-examples/tpu-examples/single-host-inference/jax/stable-diffusion/stable_diffusion_request.py`)
- Job mutation webhook → GKE clusters: mutates job spec
- Node pool creation → GKE cloud provider: ensures node pool (evidence: `tpu-provisioner/internal/controller/creation_controller.go`)
- Node pool cleanup → GKE cloud provider: deletes node pool (evidence: `tpu-provisioner/internal/controller/deletion_controller.go`)
- Distributed batch training → GKE clusters: runs workload
