# lpabon/kubeup architecture

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

- Interactive diagram: https://gitdiagram.com/lpabon/kubeup
- Repository: https://github.com/lpabon/kubeup

## Overview

##### Main Components

a. Host System Layer:
- Libvirt/KVM virtualization platform
- Local Docker registry (if enabled)
- Kubeup container that runs Vagrant

b. Virtual Machine Layer:
- Kubernetes master node
- Three worker nodes
- Networking between nodes

c. Kubernetes Components:
- K3S (for v3.0.0+)
- Cilium (replacing kube-proxy)
- Longhorn storage system

##### Component Relationships

- Network connections between master and worker nodes
- Connection from VMs to local Docker registry via socat tunnel
- Control plane communications between master and nodes

##### Architectural Elements

- Rectangle for the host system (outer container)
- Rounded rectangles for VMs
- Hexagons for Kubernetes components

##### Implementation Details

Annotations showing:
- Ansible roles (common, master, nodes, longhorn)
- Network configurations (cilium.conf)
- Service configurations (docker-localhost.service)
- Storage configurations (Longhorn)

##### Workflow Indicators

- Initial provisioning flow (up.sh)
- Kubernetes cluster formation
- Container registry access paths
- Configuration file distribution

**┌─ Host System ──────────────────────────────┐**
- ┌─ kubeup container ─┐ ┌─ Docker Registry ┐│
- Vagrant        │ │  - Local Images  ││
- vagrant-libvirt│ └─────────────────┘││
- ┘                     ││
- ┌─ Virtual Machines ────────────────────┐ ││
- ┌─ Master Node ─┐ ┌─ Worker Nodes ─┐  │ ││
- K3S        │ │  - Node 1      │  │ ││
- Cilium     │ │  - Node 2      │  │ ││
- Longhorn   │ │  - Node 3      │  │ ││
- ┘ └───────────────┘  │ ││
- ┘ ││
- ┘

Important Considerations:

##### Configuration flows
- global_vars.yml application
- kubeconfig distribution
- Ansible role execution

Remember to maintain a balance between detail and clarity, focusing on the key components while providing enough information to understand the system's operation and interactions.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Host_System
        kubeup[kubeup Container]:::container
        libvirt[libvirt/KVM]:::virtualization
        registry[Local Docker Registry]:::registry
        
        kubeup --> libvirt
        kubeup --> registry
    end

    subgraph Virtual_Machines
        master[Master Node]:::master
        worker1[Worker Node 1]:::worker
        worker2[Worker Node 2]:::worker
        worker3[Worker Node 3]:::worker

        master --> worker1
        master --> worker2
        master --> worker3
    end

    subgraph Kubernetes_Components
        k3s[K3S]:::k8s
        cilium[Cilium]:::network
        longhorn[Longhorn Storage]:::storage
    end

    master --> k3s
    k3s --> cilium
    k3s --> longhorn

    kubeup --> master
    kubeup --> worker1
    kubeup --> worker2
    kubeup --> worker3

    classDef container fill:#3498db,stroke:#2980b9,color:white
    classDef virtualization fill:#2ecc71,stroke:#27ae60,color:white
    classDef registry fill:#e74c3c,stroke:#c0392b,color:white
    classDef master fill:#f1c40f,stroke:#f39c12,color:black
    classDef worker fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef k8s fill:#9b59b6,stroke:#8e44ad,color:white
    classDef network fill:#1abc9c,stroke:#16a085,color:white
    classDef storage fill:#e67e22,stroke:#d35400,color:white

    click kubeup "https://github.com/lpabon/kubeup/tree/master/kubeup"
    click master "https://github.com/lpabon/kubeup/tree/master/roles/master"
    click worker1 "https://github.com/lpabon/kubeup/tree/master/roles/nodes"
    click worker2 "https://github.com/lpabon/kubeup/tree/master/roles/nodes"
    click worker3 "https://github.com/lpabon/kubeup/tree/master/roles/nodes"
    click cilium "https://github.com/lpabon/kubeup/blob/master/roles/common/files/cilium.conf"
    click longhorn "https://github.com/lpabon/kubeup/tree/master/roles/longhorn"
    click registry "https://github.com/lpabon/kubeup/blob/master/roles/common/templates/docker-localhost.service.j2"

    %% Legend
    subgraph Legend
        L1[Container]:::container
        L2[Virtualization]:::virtualization
        L3[Registry]:::registry
        L4[Master Node]:::master
        L5[Worker Node]:::worker
        L6[K8s Component]:::k8s
        L7[Network]:::network
        L8[Storage]:::storage
    end
```
