# linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242 architecture

> Architecture diagram of the GitHub repository linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242, 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/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242
- Repository: https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242

## Overview

##### Project type and purpose
- From the README and folder layout, this is a cloud-native sample application (Spring Boot) taught in a LinkedIn Learning course. Its goal is to demonstrate the end-to-end lifecycle: developer environment, CI/CD, container image creation (including native images), Kubernetes deployment, database integration, ingress routing, and monitoring.

##### File structure
- Top level:
- .devcontainer & .vscode – GitHub Codespaces/dev-container setup.
- .github – GitHub Actions workflows for CI/CD.
- config/… – Kubernetes manifests for multiple environments: ingress controller, kind (local cluster), monitoring stack, Postgres.
- dat/data.sql – initial seed data for Postgres.
- scripts/… – helper scripts: install cluster & deploy, destroy, populate DB.
- Application source code (Spring Boot) lives in the same repo but is delivered in code-exercise branches (not shown here). The “main” branch holds final application code plus this infrastructure.

##### Key insights from the README
- This is a multi-chapter course; the `main` branch demonstrates the final, production-style deployment.
- The emphasis is on automating builds (GitHub Actions), containerization, Kubernetes deployment patterns, and operational concerns (testing, security, monitoring).

a. Developer Environment
– GitHub Codespaces / VS Code dev-container.
– Local scripts (install.sh, destroy.sh, populate-db.sh).
b. Source & CI/CD
– GitHub repository (branches for exercises).
– GitHub Actions workflow (build → test → container image → push to registry).
c. Container Registry
– Docker Hub / private registry (stores Spring Boot image and native image).
d. Kubernetes Cluster
– Kind cluster (for local demo) or cloud-hosted K8s.
– Namespaces (e.g., default, monitoring).
– Ingress Controller (deployments + Service + ingress rules).
– Spring Boot Deployment (Pods, ReplicaSets) + Service.
– ConfigMaps/Secrets for configuration.
– Postgres StatefulSet + PersistentVolumeClaim + Service.
– Monitoring Stack (e.g., Prometheus, Grafana).
e. Data Initialization
– dat/data.sql run by an init container or via scripts.
f. End users & external traffic
– Browser/API client → Ingress → Spring Boot services.

##### Relationships and data flows
- Developer commits → GitHub → triggers CI/CD pipeline → builds Docker image → pushes to registry.
- CI/CD triggers `scripts/install.sh` to apply config manifests to K8s (`kubectl apply -f config/...`).
- Kubernetes provisions: Postgres → waits for ready → Spring Boot pods start, mount ConfigMaps/Secrets and init database using dat/data.sql or `scripts/populate-db.sh`.
- Ingress routes external HTTP(S) traffic to Spring Boot Service.
- Monitoring stack scrapes metrics from Spring Boot and Postgres exporters.

##### Architectural patterns & design principles
- Twelve-Factor App: externalize config (ConfigMaps, Secrets), stateless services, backing services (Postgres).
- Infrastructure as Code: config/… manifests, scripts for automation.
- GitOps-style flow: repository drives cluster state via CI/CD.
- Observability: side-by-side monitoring namespace, metrics scraping.

##### Technologies and frameworks
- Spring Boot (Java / native image via GraalVM)
- Docker / container images
- Kubernetes (kind for local, ingress controller)
- Postgres (database)
- Prometheus & Grafana (monitoring)
- GitHub Actions (CI/CD)
- GitHub Codespaces / devcontainer (developer environment)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer & CI/CD Layer
    subgraph "Developer & CI/CD Layer"
        direction TB
        DevContainer["GitHub Codespaces / dev-container"]:::devtools
        VSCode["VS Code Settings"]:::devtools
        ScriptsInstall["install.sh"]:::scripts
        ScriptsDestroy["destroy.sh"]:::scripts
        ScriptsPopulate["populate-db.sh"]:::scripts
        GitHubRepo["GitHub Repository"]:::infra
        GitHubActions["GitHub Actions Workflow"]:::ci
        CODEOWNERS["CODEOWNERS"]:::infra
        PRTemplate["PULL_REQUEST_TEMPLATE.md"]:::infra
        IssueTemplate["ISSUE_TEMPLATE.md"]:::infra
        README["README.md"]:::docs
        CONTRIBUTING["CONTRIBUTING.md"]:::docs
        LICENSE["LICENSE"]:::docs
        NOTICE["NOTICE"]:::docs

        DevContainer -->|commits code| GitHubRepo
        VSCode -->|commits code| GitHubRepo
        GitHubRepo -->|triggers| GitHubActions
        GitHubActions -->|runs| ScriptsInstall
        GitHubActions -->|runs| ScriptsDestroy
        GitHubActions -->|runs| ScriptsPopulate
    end

    %% Container Registry
    subgraph "Container Registry"
        direction TB
        DockerRegistry["Docker Hub / Private Registry"]:::registry
    end

    GitHubActions -->|builds image| DockerRegistry

    %% Kubernetes Cluster
    subgraph "Kubernetes Cluster"
        direction TB
        subgraph "Ingress Layer"
            direction TB
            IngressController["Ingress Controller"]:::infra
        end

        subgraph "Application Namespace"
            direction TB
            ConfigMaps["ConfigMaps/Secrets"]:::config
            SpringBootDep["Spring Boot Deployment"]:::app
            AppService["Application Service"]:::service
        end

        subgraph "Data Namespace"
            direction TB
            PostgresStateful["Postgres StatefulSet + PVC"]:::db
            PostgresService["Postgres Service"]:::service
        end

        subgraph "Monitoring Namespace"
            direction TB
            Prometheus["Prometheus"]:::monitoring
            Grafana["Grafana"]:::monitoring
        end

        ScriptsInstall -->|apply manifests| IngressController
        ScriptsInstall -->|apply manifests| ConfigMaps
        ScriptsInstall -->|apply manifests| SpringBootDep
        ScriptsInstall -->|apply manifests| AppService
        ScriptsInstall -->|apply manifests| PostgresStateful
        ScriptsInstall -->|apply manifests| PostgresService
        ScriptsInstall -->|apply manifests| Prometheus
        ScriptsInstall -->|apply manifests| Grafana

        DockerRegistry -->|pulls image| SpringBootDep

        IngressController -->|routes HTTP| AppService
        AppService -->|forwards to| SpringBootDep
        SpringBootDep -->|reads/writes| PostgresService
        PostgresService -->|connects to| PostgresStateful

        SpringBootDep -->|exposes metrics| Prometheus
        PostgresStateful -->|exposes metrics| Prometheus
        Prometheus -->|data| Grafana
    end

    %% External Users
    Browser["Browser / API Client"]:::external
    Browser -->|HTTP requests| IngressController

    %% Click Events
    click DevContainer "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/blob/main/.devcontainer/devcontainer.json"
    click VSCode "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/tree/main/.vscode/"
    click ScriptsInstall "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/blob/main/scripts/install.sh"
    click ScriptsDestroy "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/blob/main/scripts/destroy.sh"
    click ScriptsPopulate "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/blob/main/scripts/populate-db.sh"
    click GitHubActions "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/blob/main/.github/workflows/main.yml"
    click CODEOWNERS "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/tree/main/.github/CODEOWNERS"
    click PRTemplate "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/blob/main/.github/PULL_REQUEST_TEMPLATE.md"
    click IssueTemplate "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/blob/main/.github/ISSUE_TEMPLATE.md"
    click README "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/blob/main/README.md"
    click CONTRIBUTING "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/blob/main/CONTRIBUTING.md"
    click LICENSE "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/tree/main/LICENSE"
    click NOTICE "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/tree/main/NOTICE"
    click IngressController "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/blob/main/config/ingress/config.yaml"
    click IngressController "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/blob/main/config/ingress/deploy.sh"
    click ScriptsInstall "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/blob/main/config/kind/config.yaml"
    click ScriptsInstall "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/blob/main/config/kind/deploy.sh"
    click Prometheus "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/blob/main/config/monitoring/config.yaml"
    click Prometheus "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/blob/main/config/monitoring/deploy.sh"
    click PostgresStateful "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/blob/main/config/postgres/config.yaml"
    click PostgresStateful "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/blob/main/config/postgres/deploy.sh"
    click dat "https://github.com/linkedinlearning/spring-on-kubernetes-deploying-and-managing-cloud-native-applications-5913242/blob/main/dat/data.sql"

    %% Styles
    classDef devtools fill:#f2f2f2,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    classDef infra fill:#d9d9d9,stroke:#333,stroke-width:1px
    classDef scripts fill:#fff2cc,stroke:#333,stroke-width:1px
    classDef ci fill:#ffe699,stroke:#333,stroke-width:1px
    classDef registry fill:#cfe2f3,stroke:#333,stroke-width:1px
    classDef app fill:#9fc5e8,stroke:#333,stroke-width:1px
    classDef service fill:#b4a7d6,stroke:#333,stroke-width:1px
    classDef db fill:#b6d7a8,stroke:#333,stroke-width:1px
    classDef config fill:#d9ead3,stroke:#333,stroke-width:1px
    classDef monitoring fill:#f9cb9c,stroke:#333,stroke-width:1px
    classDef external fill:#f4cccc,stroke:#333,stroke-width:1px
    classDef docs fill:#ead1dc,stroke:#333,stroke-width:1px
```
