# harisekhon/kubernetes-configs architecture

> Architecture diagram of the GitHub repository harisekhon/kubernetes-configs, 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/harisekhon/kubernetes-configs
- Repository: https://github.com/harisekhon/kubernetes-configs

## Overview

##### Project Type and Purpose
- This is not an application codebase but a Kubernetes configuration repository (“Kubernetes-configs”).
- It provides:
- Top-level YAML templates for Deployments, StatefulSets, Services, Ingress, HPA, PVC/PV, RBAC, etc.
- “Real-world” app directories following a Kustomize base/overlay pattern for ArgoCD, Jenkins, TeamCity, Selenium Grid, Traefik, Kong, cert-manager, monitoring (Prometheus), security scanners (Clair, Trivy), external-DNS, MetalLB, etc.
- CI/CD workflows (GitHub Actions, Travis, GitLab CI, Azure DevOps, Buildkite) for linting, validation, security scanning and GitOps deployment.

##### High-Level Architecture Components
a. Git Repository (GitHub/GitLab/Azure DevOps/Bitbucket)
- Contains all YAMLs, kustomization.yaml, overlays, Helm repo lists and helper scripts (install_repos.sh).
- Triggers CI/CD workflows on push/PR.
b. CI/CD Pipelines
- GitHub Actions / Travis / Buildkite etc.
- Steps: YAML/JSON/Markdown validation → Static analysis (Semgrep, Checkov, Kics, Polaris) → Container scan (Trivy, Grype) → Kustomize build dry-run.
c. Kustomize + Helm Integration
- “base/” directories hold core manifests.
- “overlay/” directories hold environment-specific patches (ingress hostnames, resource limits, secrets references).
- kustomization.yaml at root orchestrates templating of base and overlay, with optional HelmChart loader.
d. GitOps Controller (ArgoCD, optionally FluxCD)
- Watches Git repo, compares desired state (manifests) to cluster state.
- Automatically applies changes to cluster.
e. Kubernetes Cluster
- Control plane (API Server, etcd, Scheduler, Controllers).
- Multiple Namespaces, one per app (argocd, jenkins, teamcity, selenium-grid, traefik, kong, cert-manager, external-dns, monitoring, security-tools).
- Core add-ons: CoreDNS, Ingress Controller (NGINX/Traefik/Kong), RBAC, Network Policies, StorageClasses, MetalLB (on-prem), External-DNS.
f. External Services and Integrations
- Container Image Registries (DockerHub, GCR, ECR, private Harbor).
- Secret backends (External-Secrets: AWS Secrets Manager, GCP Secret Manager, Azure Key Vault).
- Helm Repositories (stable, bitnami, fairwinds-stable).
- Cloud load balancers, DNS providers, Object Storage for persistent volume provisioning.
- Monitoring & Alerting (Prometheus-stack, Grafana).
- CI servers & artifact stores (Jenkins, TeamCity, SonarQube).

##### Relationships and Data-Flow
- Developer pushes YAML to Git ⇒ CI/CD pipeline runs linters and security scans ⇒ on success, commit merged to main.
- GitOps controller (ArgoCD) detects new commit ⇒ Builds manifests via Kustomize/Helm ⇒ Applies them to Kubernetes API.
- Kubernetes Scheduler launches Pods in appropriate namespaces.
- Ingress/Service exposes applications externally via LB or MetalLB.
- External-DNS updates DNS records automatically.
- Cert-manager provisions TLS certificates from Let’s Encrypt or other issuers.
- Monitoring & Logging collect metrics/events for all namespaces.

##### Architectural Patterns and Principles
- GitOps: declarative cluster management with ArgoCD/FluxCD.
- Modular Kustomize layering: “base” (common) + “overlay” (env-specific).
- Infrastructure as Code: all resources versioned.
- Continuous Security: pipeline includes static analysis and container scanning.
- Multi-tenancy via Namespaces and RBAC.
- Extensibility: each app directory is a self-contained Kustomize package.

##### Key Technologies & Frameworks
- Kubernetes (YAML manifests)
- Kustomize (overlayed configuration)
- Helm (optional templating)
- ArgoCD / FluxCD (GitOps)
- GitHub Actions / Travis / Buildkite (CI/CD)
- Semgrep, Checkov, KICS, Polaris (policy as code)
- Trivy, Grype, Clair (container scanning)
- cert-manager (TLS certificates)
- External-DNS, MetalLB (DNS & Load Balancing in Kubernetes)
- Prometheus-stack, Grafana (monitoring)
- Secret Store Integrations (AWS, Azure, GCP)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Swimlanes / Zones
    subgraph "Developer & GitOps" 
        direction TB
        Dev["Developer"]:::external
        GitRepo["Git Repository"]:::git
    end

    subgraph "CI/CD Pipelines" 
        direction TB
        Lint["Lint & Validation"]:::ci
        StaticAnalysis["Static Analysis"]:::ci
        ContainerScan["Container Scan"]:::ci
        KustomizeBuild["Kustomize Build Dry-run"]:::ci
        Merge["Merge to main"]:::ci
    end

    subgraph "GitOps Controller" 
        direction TB
        ArgoCD["ArgoCD"]:::gitops
        FluxCD["FluxCD (alt)"]:::gitops
    end

    subgraph "Kubernetes Cluster" 
        direction TB
        API["Kubernetes API Server"]:::core
        Scheduler["Scheduler & Controllers"]:::core
        subgraph "Namespaces" 
            direction TB
            ArgocdNS["argocd NS"]:::workload
            JenkinsNS["jenkins NS"]:::workload
            TeamCityNS["teamcity NS"]:::workload
            SeleniumNS["selenium-grid NS"]:::workload
            SeleniumDistNS["selenium-grid-distributed NS"]:::workload
            TraefikNS["traefik NS"]:::workload
            KongNS["kong NS"]:::workload
            CertMgrNS["cert-manager NS"]:::workload
            ExtDNSNS["external-dns NS"]:::workload
            MetalLBNS["metal-lb NS"]:::workload
            PromStackNS["prometheus-stack NS"]:::workload
            PromNS["prometheus NS"]:::workload
            ClairNS["clair NS"]:::workload
            TrivyNS["trivy NS"]:::workload
            TrivyOpNS["trivy-operator NS"]:::workload
            PolarisNS["polaris NS"]:::workload
        end
        subgraph "Cluster Add-ons"
            direction TB
            IngressCtrl["Ingress Controller"]:::core
            ExternalDNS["External-DNS"]:::core
            MetalLB["MetalLB"]:::core
            CertManager["cert-manager"]:::core
            PrometheusStack["Prometheus-stack"]:::core
            Grafana["Grafana"]:::core
        end
    end

    subgraph "External Services & Integrations"
        direction TB
        ImageRegistry["Image Registries"]:::ext
        SecretStores["Secret Backends"]:::ext
        HelmRepos["Helm Repositories"]:::ext
        CloudLB["Cloud Load Balancers"]:::ext
        DNSProvider["DNS Providers"]:::ext
        ObjectStorage["Object Storage"]:::ext
        Monitoring["Monitoring & Alerting"]:::ext
        CI_Servers["CI Servers & Artifact Stores"]:::ext
    end

    %% Connections
    Dev -->|push YAML| GitRepo
    GitRepo -->|triggers| Lint
    Lint --> StaticAnalysis
    StaticAnalysis --> ContainerScan
    ContainerScan --> KustomizeBuild
    KustomizeBuild --> Merge
    Merge -->|new commit| ArgoCD
    Merge -->|new commit| FluxCD
    ArgoCD -->|sync| API
    FluxCD -->|sync| API
    API --> Scheduler
    Scheduler --> ArgocdNS
    Scheduler --> JenkinsNS
    Scheduler --> TeamCityNS
    Scheduler --> SeleniumNS
    Scheduler --> SeleniumDistNS
    Scheduler --> TraefikNS
    Scheduler --> KongNS
    Scheduler --> CertMgrNS
    Scheduler --> ExtDNSNS
    Scheduler --> MetalLBNS
    Scheduler --> PromStackNS
    Scheduler --> PromNS
    Scheduler --> ClairNS
    Scheduler --> TrivyNS
    Scheduler --> TrivyOpNS
    Scheduler --> PolarisNS

    IngressCtrl -->|routes| TraefikNS
    IngressCtrl -->|routes| KongNS
    ExternalDNS -->|updates| DNSProvider
    MetalLB -->|LB IPs| TraefikNS
    CertManager -->|certs| CertMgrNS
    PrometheusStack -->|metrics| Monitoring
    Grafana -->|dashboards| Monitoring

    ArgocdNS -->|pull images| ImageRegistry
    JenkinsNS -->|pull images| ImageRegistry
    TeamCityNS -->|pull images| ImageRegistry
    SeleniumNS -->|pull images| ImageRegistry
    SeleniumDistNS -->|pull images| ImageRegistry

    CertMgrNS -->|fetch secrets| SecretStores
    ExtDNSNS -->|fetch secrets| SecretStores

    ArgocdNS --> HelmRepos
    JenkinsNS --> HelmRepos

    %% Click Events - component mappings
    click GitRepo "https://github.com/harisekhon/kubernetes-configs/tree/master/./"
    click Lint "https://github.com/harisekhon/kubernetes-configs/tree/master/.github/workflows/"
    click StaticAnalysis "https://github.com/harisekhon/kubernetes-configs/tree/master/.github/actions/"
    click ContainerScan "https://github.com/harisekhon/kubernetes-configs/blob/master/.travis.yml"
    click Merge "https://github.com/harisekhon/kubernetes-configs/tree/master/setup/buildkite/Makefile"
    click Merge "https://github.com/harisekhon/kubernetes-configs/blob/master/setup/ci_bootstrap.sh"
    click KustomizeBuild "https://github.com/harisekhon/kubernetes-configs/blob/master/kustomization.yaml"
    click ArgoCD "https://github.com/harisekhon/kubernetes-configs/tree/master/argocd/base/"
    click ArgoCD "https://github.com/harisekhon/kubernetes-configs/tree/master/argocd/overlay/"
    click FluxCD "https://github.com/harisekhon/kubernetes-configs/tree/master/fluxcd/base/"
    click FluxCD "https://github.com/harisekhon/kubernetes-configs/tree/master/fluxcd/overlay/"
    click ArgocdNS "https://github.com/harisekhon/kubernetes-configs/tree/master/argocd/base/"
    click JenkinsNS "https://github.com/harisekhon/kubernetes-configs/tree/master/jenkins/base/"
    click JenkinsNS "https://github.com/harisekhon/kubernetes-configs/tree/master/jenkins/overlay/"
    click TeamCityNS "https://github.com/harisekhon/kubernetes-configs/tree/master/teamcity/base/"
    click TeamCityNS "https://github.com/harisekhon/kubernetes-configs/tree/master/teamcity/overlay/"
    click SeleniumNS "https://github.com/harisekhon/kubernetes-configs/tree/master/selenium-grid/base/"
    click SeleniumNS "https://github.com/harisekhon/kubernetes-configs/tree/master/selenium-grid/overlay/"
    click SeleniumDistNS "https://github.com/harisekhon/kubernetes-configs/tree/master/selenium-grid-distributed/base/"
    click SeleniumDistNS "https://github.com/harisekhon/kubernetes-configs/tree/master/selenium-grid-distributed/overlay/"
    click TraefikNS "https://github.com/harisekhon/kubernetes-configs/tree/master/traefik/base/"
    click TraefikNS "https://github.com/harisekhon/kubernetes-configs/tree/master/traefik/overlay/"
    click KongNS "https://github.com/harisekhon/kubernetes-configs/tree/master/kong/base/"
    click KongNS "https://github.com/harisekhon/kubernetes-configs/tree/master/kong/overlay/"
    click CertMgrNS "https://github.com/harisekhon/kubernetes-configs/tree/master/cert-manager/base/"
    click CertMgrNS "https://github.com/harisekhon/kubernetes-configs/tree/master/cert-manager/overlay/"
    click ExtDNSNS "https://github.com/harisekhon/kubernetes-configs/tree/master/external-dns/base/"
    click ExtDNSNS "https://github.com/harisekhon/kubernetes-configs/tree/master/external-dns/overlay/"
    click MetalLBNS "https://github.com/harisekhon/kubernetes-configs/tree/master/metal-lb/base/"
    click MetalLBNS "https://github.com/harisekhon/kubernetes-configs/tree/master/metal-lb/overlay/"
    click PromStackNS "https://github.com/harisekhon/kubernetes-configs/tree/master/prometheus-stack/base/"
    click PromStackNS "https://github.com/harisekhon/kubernetes-configs/tree/master/prometheus-stack/overlay/"
    click PromNS "https://github.com/harisekhon/kubernetes-configs/tree/master/prometheus/base/"
    click PromNS "https://github.com/harisekhon/kubernetes-configs/tree/master/prometheus/overlay/"
    click ClairNS "https://github.com/harisekhon/kubernetes-configs/tree/master/clair/base/"
    click ClairNS "https://github.com/harisekhon/kubernetes-configs/tree/master/clair/overlay/"
    click TrivyNS "https://github.com/harisekhon/kubernetes-configs/tree/master/trivy/base/"
    click TrivyNS "https://github.com/harisekhon/kubernetes-configs/tree/master/trivy/overlay/"
    click TrivyOpNS "https://github.com/harisekhon/kubernetes-configs/tree/master/trivy-operator/base/"
    click TrivyOpNS "https://github.com/harisekhon/kubernetes-configs/tree/master/trivy-operator/overlay/"
    click PolarisNS "https://github.com/harisekhon/kubernetes-configs/tree/master/polaris/base/"
    click PolarisNS "https://github.com/harisekhon/kubernetes-configs/tree/master/polaris/overlay/"
    click StaticAnalysis "https://github.com/harisekhon/kubernetes-configs/blob/master/.checkov.yaml"
    click StaticAnalysis "https://github.com/harisekhon/kubernetes-configs/blob/master/.github/workflows/kics.yaml"
    click StaticAnalysis "https://github.com/harisekhon/kubernetes-configs/blob/master/.github/workflows/semgrep.yaml"
    click StaticAnalysis "https://github.com/harisekhon/kubernetes-configs/blob/master/.github/workflows/semgrep-cloud.yaml"
    click StaticAnalysis "https://github.com/harisekhon/kubernetes-configs/blob/master/.github/workflows/datree-*.yaml"
    click StaticAnalysis "https://github.com/harisekhon/kubernetes-configs/blob/master/.github/workflows/kubevious.yaml"
    click StaticAnalysis "https://github.com/harisekhon/kubernetes-configs/blob/master/helm-repos.txt"
    click API "https://github.com/harisekhon/kubernetes-configs/blob/master/namespace.yaml"
    click API "https://github.com/harisekhon/kubernetes-configs/blob/master/clusterrole.yaml"
    click API "https://github.com/harisekhon/kubernetes-configs/blob/master/role.yaml"
    click API "https://github.com/harisekhon/kubernetes-configs/blob/master/rolebinding.yaml"
    click API "https://github.com/harisekhon/kubernetes-configs/blob/master/quota.yaml"

    %% Styles
    classDef git fill:#D8B0FF,stroke:#9B3ED6,color:#000
    classDef ci fill:#B0D8FF,stroke:#369BD6,color:#000
    classDef gitops fill:#E0B0FF,stroke:#8E3ED6,color:#000
    classDef core fill:#B0FFC0,stroke:#36D66A,color:#000
    classDef workload fill:#A0FFA0,stroke:#2DBA3D,color:#000
    classDef external fill:#FFD0B0,stroke:#D67E36,color:#000
    classDef ext fill:#FFD0B0,stroke:#D67E36,color:#000
    class Dev external
    class Merge ci
    class Merge setup/buildkite/Makefile
    class Merge setup/ci_bootstrap.sh
```
