# carlosmbteixeira/k8s-production-lab architecture

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

- Interactive diagram: https://gitdiagram.com/carlosmbteixeira/k8s-production-lab
- Repository: https://github.com/carlosmbteixeira/k8s-production-lab

## Overview

This repository automates a rebuildable Kubernetes lab: it creates local VMs, provisions their prerequisites, bootstraps a highly available cluster, then supports cluster services and application installs. The documented operator flow starts with lab management and continues through the pipeline; applications are selected one at a time because of the host RAM limit. The graph preserves documented networking, GitOps, TLS, observability, and policy capabilities. No source excerpts were available, so relationships below are limited to those stated in the README; unsampled implementation details are not inferred.

Main entry points: [`scripts/pipeline/main.sh`](https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/scripts/pipeline/main.sh) (Install pipeline), [`ansible/site.yml`](https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/ansible/site.yml) (Ansible provisioning), [`ansible/roles/kubeadm-init/tasks/main.yml`](https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/ansible/roles/kubeadm-init/tasks/main.yml) (HA cluster bootstrap), [`scripts/lab-management.sh`](https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/scripts/lab-management.sh) (Lab management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_host["Host and VMs"]
  node_windows["Windows host"]
  node_wsl["WSL2 Ubuntu"]
  node_multipass["Multipass VMs"]
  node_labmgmt["Lab management<br/>[lab-management.sh]"]
end

subgraph group_provision["Node Provisioning"]
  node_pipeline["Install pipeline<br/>[main.sh]"]
  node_ansible["Ansible provisioning<br/>[site.yml]"]
  node_prereqs["Node prerequisites<br/>[main.yml]"]
  node_containerd["Container runtime<br/>[main.yml]"]
end

subgraph group_cluster["Cluster Bootstrap"]
  node_clusterbuild["HA cluster bootstrap<br/>[main.yml]"]
  node_vip["Control-plane VIP<br/>[main.yml]"]
  node_calico["Calico networking<br/>[main.yml]"]
end

subgraph group_platform["Cluster Services"]
  node_gateway["Gateway API and MetalLB"]
  node_certs["TLS certificates<br/>[clusterissuer.yaml]"]
  node_policies["Network policies<br/>[monitoring.yaml]"]
end

subgraph group_apps["Applications and Access"]
  node_argocd["Argo CD GitOps<br/>[root-app.yaml]"]
  node_rancher["Rancher<br/>[05_rancher.sh]"]
  node_observability["Metrics and dashboards<br/>[values.yaml]"]
  node_logging["Log aggregation<br/>[loki-values.yaml]"]
  node_access["UI access<br/>[argocd-tunnel.sh]"]
end

node_operator(("Lab operator"))
node_gitopsrepo["GitOps manifests repo"]

node_operator -->|"runs rebuild"| node_labmgmt
node_windows -->|"hosts"| node_wsl
node_wsl -->|"runs"| node_multipass
node_labmgmt -->|"builds VMs"| node_multipass
node_operator -->|"runs install"| node_pipeline
node_pipeline -->|"provisions nodes"| node_ansible
node_ansible -->|"prepares nodes"| node_prereqs
node_ansible -->|"installs runtime"| node_containerd
node_pipeline -->|"bootstraps cluster"| node_clusterbuild
node_clusterbuild -->|"uses VIP"| node_vip
node_clusterbuild -->|"installs CNI"| node_calico
node_pipeline -->|"sets up networking"| node_gateway
node_pipeline -->|"installs cluster infra"| node_certs
node_pipeline -->|"applies policies"| node_policies
node_gitopsrepo -->|"provides manifests"| node_argocd
node_pipeline -->|"installs application"| node_argocd
node_pipeline -->|"installs application"| node_rancher
node_pipeline -->|"installs application"| node_observability
node_observability -->|"integrates logs"| node_logging
node_operator -->|"opens UI tunnel"| node_access
node_gateway -->|"enables direct access"| node_access

click node_labmgmt "https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/scripts/lab-management.sh"
click node_pipeline "https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/scripts/pipeline/main.sh"
click node_ansible "https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/ansible/site.yml"
click node_prereqs "https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/ansible/roles/kernel-prereqs/tasks/main.yml"
click node_containerd "https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/ansible/roles/containerd-install/tasks/main.yml"
click node_clusterbuild "https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/ansible/roles/kubeadm-init/tasks/main.yml"
click node_vip "https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/ansible/roles/kube-vip/tasks/main.yml"
click node_calico "https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/ansible/roles/cni-calico/tasks/main.yml"
click node_gateway "https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/scripts/pipeline/03_gateway_api_metallb.sh"
click node_certs "https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/kubernetes/manifests/cert_manager/clusterissuer.yaml"
click node_policies "https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/kubernetes/manifests/network_policies/monitoring.yaml"
click node_argocd "https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/kubernetes/manifests/argocd/apps/root-app.yaml"
click node_rancher "https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/scripts/pipeline/05_rancher.sh"
click node_observability "https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/kubernetes/manifests/observability/values.yaml"
click node_logging "https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/kubernetes/manifests/observability/loki-values.yaml"
click node_access "https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/scripts/tunnels/argocd-tunnel.sh"

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_windows,node_wsl,node_multipass,node_labmgmt toneBlue
class node_pipeline,node_ansible,node_prereqs,node_containerd toneAmber
class node_clusterbuild,node_vip,node_calico toneMint
class node_gateway,node_certs,node_policies toneRose
class node_argocd,node_rancher,node_observability,node_logging,node_access,node_operator,node_gitopsrepo toneIndigo
```

## Components

### Host and VMs

- **Windows host**
- **WSL2 Ubuntu**
- **Multipass VMs**
- [Lab management](https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/scripts/lab-management.sh): `scripts/lab-management.sh`

### Node Provisioning

- [Install pipeline](https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/scripts/pipeline/main.sh): `scripts/pipeline/main.sh`
- [Ansible provisioning](https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/ansible/site.yml): `ansible/site.yml`
- [Node prerequisites](https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/ansible/roles/kernel-prereqs/tasks/main.yml): `ansible/roles/kernel-prereqs/tasks/main.yml`
- [Container runtime](https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/ansible/roles/containerd-install/tasks/main.yml): `ansible/roles/containerd-install/tasks/main.yml`

### Cluster Bootstrap

- [HA cluster bootstrap](https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/ansible/roles/kubeadm-init/tasks/main.yml): `ansible/roles/kubeadm-init/tasks/main.yml`
- [Control-plane VIP](https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/ansible/roles/kube-vip/tasks/main.yml): `ansible/roles/kube-vip/tasks/main.yml`
- [Calico networking](https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/ansible/roles/cni-calico/tasks/main.yml): `ansible/roles/cni-calico/tasks/main.yml`

### Cluster Services

- [Gateway API and MetalLB](https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/scripts/pipeline/03_gateway_api_metallb.sh): `scripts/pipeline/03_gateway_api_metallb.sh`
- [TLS certificates](https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/kubernetes/manifests/cert_manager/clusterissuer.yaml): `kubernetes/manifests/cert_manager/clusterissuer.yaml`
- [Network policies](https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/kubernetes/manifests/network_policies/monitoring.yaml): `kubernetes/manifests/network_policies/monitoring.yaml`

### Applications and Access

- [Argo CD GitOps](https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/kubernetes/manifests/argocd/apps/root-app.yaml): `kubernetes/manifests/argocd/apps/root-app.yaml`
- [Rancher](https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/scripts/pipeline/05_rancher.sh): `scripts/pipeline/05_rancher.sh`
- [Metrics and dashboards](https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/kubernetes/manifests/observability/values.yaml): `kubernetes/manifests/observability/values.yaml`
- [Log aggregation](https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/kubernetes/manifests/observability/loki-values.yaml): `kubernetes/manifests/observability/loki-values.yaml`
- [UI access](https://github.com/carlosmbteixeira/k8s-production-lab/blob/main/scripts/tunnels/argocd-tunnel.sh): `scripts/tunnels/argocd-tunnel.sh`

### Other components

- **Lab operator**
- **GitOps manifests repo**

## Connections

- Lab operator → Lab management: runs rebuild (evidence: `README.md`)
- Windows host → WSL2 Ubuntu: hosts (evidence: `README.md`)
- WSL2 Ubuntu → Multipass VMs: runs (evidence: `README.md`)
- Lab management → Multipass VMs: builds VMs (evidence: `README.md`)
- Lab operator → Install pipeline: runs install (evidence: `README.md`)
- Install pipeline → Ansible provisioning: provisions nodes (evidence: `README.md`)
- Ansible provisioning → Node prerequisites: prepares nodes (evidence: `README.md`)
- Ansible provisioning → Container runtime: installs runtime (evidence: `README.md`)
- Install pipeline → HA cluster bootstrap: bootstraps cluster (evidence: `README.md`)
- HA cluster bootstrap → Control-plane VIP: uses VIP (evidence: `README.md`)
- HA cluster bootstrap → Calico networking: installs CNI (evidence: `README.md`)
- Install pipeline → Gateway API and MetalLB: sets up networking (evidence: `README.md`)
- Install pipeline → TLS certificates: installs cluster infra (evidence: `README.md`)
- Install pipeline → Network policies: applies policies (evidence: `README.md`)
- GitOps manifests repo → Argo CD GitOps: provides manifests (evidence: `README.md`)
- Install pipeline → Argo CD GitOps: installs application (evidence: `README.md`)
- Install pipeline → Rancher: installs application (evidence: `README.md`)
- Install pipeline → Metrics and dashboards: installs application (evidence: `README.md`)
- Metrics and dashboards → Log aggregation: integrates logs (evidence: `README.md`)
- Lab operator → UI access: opens UI tunnel (evidence: `README.md`)
- Gateway API and MetalLB → UI access: enables direct access (evidence: `README.md`)
