# killerlux/cloudprojet architecture

> Architecture diagram of the GitHub repository killerlux/cloudprojet, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/killerlux/cloudprojet
- Repository: https://github.com/killerlux/cloudprojet

## Overview

##### Project Type & Purpose
- A Kubernetes-based “cloud migration” lab: uses Vagrant to spin up a 2-node local K8s cluster (1 master, 1 worker) and deploys Nginx plus Odoo + PostgreSQL via YAML manifests.

##### Main Components
- Host machine: runs Vagrant/VirtualBox
- Vagrant infra:
– Vagrantfile + setup scripts → provisions k8s-master & k8s-worker01
- Kubernetes cluster:
– Control plane (kube-apiserver, etcd, scheduler) on master
– Worker node (kubelet, kube-proxy) with hostPath PV on /mnt/data-postgres-pv
- Applications (in namespace clay-technology-prod):
– Nginx Deployment + Service
– Odoo + PostgreSQL (ConfigMap, PV/PVC, Deployments, Services)

##### Relationships & Data Flows
- Vagrantfile → triggers master-setup.sh → initializes kubeadm control-plane
- kubeadm join → worker registers with master
- kubectl apply (namespace, apps) → API server → etcd → scheduler → kubelets
- User HTTP traffic → NodePort on worker → Service → Pod

##### Architectural Patterns & Technologies
- Immutable infra as code (Vagrant + shell scripts)
- Kubernetes control-plane/worker separation
- HostPath PersistentVolume for PostgreSQL
- Namespaced deployments for isolation
- YAML manifests for declarative deployments

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Host Machine & Vagrant Infra
    subgraph "Host Machine"
        VM[Vagrant/VirtualBox]:::infra
    end
    VM -->|provisions| VFile["Vagrantfile"]:::infra
    click VFile "https://github.com/killerlux/cloudprojet/tree/main/infrastructure-setup/Vagrantfile"
    VFile --> MSetup["master-setup.sh"]:::infra
    click MSetup "https://github.com/killerlux/cloudprojet/blob/main/infrastructure-setup/setup-scripts/master-setup.sh"
    VFile --> WSetup["worker-setup.sh"]:::infra
    click WSetup "https://github.com/killerlux/cloudprojet/blob/main/infrastructure-setup/setup-scripts/worker-setup.sh"

    %% Vagrant State
    subgraph "Vagrant State"
        MSState["k8s-master metadata"]:::infra
        click MSState "https://github.com/killerlux/cloudprojet/tree/main/infrastructure-setup/.vagrant/machines/k8s-master/virtualbox"
        WSState["k8s-worker01 metadata"]:::infra
        click WSState "https://github.com/killerlux/cloudprojet/tree/main/infrastructure-setup/.vagrant/machines/k8s-worker01/virtualbox"
    end

    %% Kubernetes Manifests Source
    subgraph "kubernetes-manifests" 
        NS["00-namespace.yaml"]:::man
        click NS "https://github.com/killerlux/cloudprojet/blob/main/kubernetes-manifests/00-namespace.yaml"
        NG["nginx-deployment-svc.yaml"]:::man
        click NG "https://github.com/killerlux/cloudprojet/blob/main/kubernetes-manifests/app-nginx/nginx-deployment-svc.yaml"
        OP["odoo-postgres-full.yaml"]:::man
        click OP "https://github.com/killerlux/cloudprojet/blob/main/kubernetes-manifests/app-odoo-postgres/odoo-postgres-full.yaml"
    end
    VM --> NS & NG & OP

    %% Kubernetes Cluster VMs
    subgraph "k8s-master" 
        API["kube-apiserver"]:::control
        ETCD["etcd"]:::control
        SCH["scheduler"]:::control
    end

    subgraph "k8s-worker01"
        KLET["kubelet"]:::worker
        KPROX["kube-proxy"]:::worker
        PV["hostPath PV (/mnt/data-postgres-pv)"]:::worker
    end

    %% Provisioning & Join
    MSetup -->|init kubeadm| API
    WSetup -->|kubeadm join| KLET
    API <-->|API calls| KLET

    %% Workloads in Namespace
    subgraph "Namespace: clay-technology-prod"
        NGApp["Nginx Deployment + Service"]:::app
        OPApp["Odoo + PostgreSQL"]:::app
    end

    %% Data & Traffic Flows
    NG --> API
    API -->|schedule| NGApp
    API -->|schedule| OPApp
    User["User HTTP Traffic"]:::extern -->|NodePort| KPROX
    KPROX -->|Service| NGApp
    KPROX -->|Service| OPApp

    %% Styles
    classDef infra fill:#D0E4F5,stroke:#0366D6,color:#0366D6
    classDef control fill:#DFF5D0,stroke:#28A745,color:#28A745
    classDef worker fill:#FFE5B4,stroke:#FF8C00,color:#FF8C00
    classDef app fill:#E5D0F5,stroke:#6F42C1,color:#6F42C1
    classDef man fill:#F0F0F0,stroke:#6A737D,color:#6A737D
    classDef extern fill:#FFFFFF,stroke:#000000,color:#000000
```
