### Start Flask Backend Server Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Start the Flask development server for the backend. Ensure the virtual environment is activated and you are in the 'backend' directory. ```bash cd backend source venv/bin/activate python3 app.py ``` -------------------------------- ### Add Helmfile Example Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/frontend/public/examples/README.md To add a new Helmfile example, create a YAML file in the 'helmfiles/' directory and register it in 'src/examples/registry.js' within the HELMFILE_EXAMPLES array. ```javascript const HELMFILE_EXAMPLES = [ // ...existing examples { id: 'my-helmfile', name: 'My Helmfile', description: 'Description of my helmfile', filePath: '/examples/helmfiles/my-helmfile.yaml' } ]; ``` -------------------------------- ### Install Backend Dependencies Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Installs all required Python packages listed in the `requirements.txt` file. ```bash pip install -r requirements.txt ``` -------------------------------- ### Build and Start Docker Compose Services Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Builds the Docker images for the services and starts them. Use this command to create and launch all defined services. ```bash docker compose up --build ``` -------------------------------- ### Start Frontend Development Server Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Launches the frontend development server. The frontend will be accessible at `http://localhost:5173`. ```bash npm run dev ``` -------------------------------- ### Start Minikube Cluster and Enable Addons Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/minikube/README.md Starts a Minikube cluster and enables the metrics-server, dashboard, and ingress addons. These are essential for monitoring and managing the cluster. ```bash $ minikube start $ minikube addons enable metrics-server $ minikube addons enable dashboard $ minikube addons enable ingress ``` -------------------------------- ### Run Frontend Development Server Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Use this command to start the frontend development server. Ensure you are in the 'frontend' directory. ```bash cd frontend npm run dev ``` -------------------------------- ### Install KubeDiagrams from Source Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Installs KubeDiagrams by cloning the repository and installing Python dependencies. Make sure to add the bin directory to your PATH. ```bash # clone the KubeDiagrams repository git clone https://github.com/philippemerle/KubeDiagrams.git # install required Python packages pip install PyYAML diagrams # make KubeDiagrams commands available into $PATH PATH=$(pwd)/KubeDiagrams/bin:$PATH ``` -------------------------------- ### Start Minikube Cluster Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/cassandra/README.md Starts a minikube cluster with specified memory and CPU resources. This is a prerequisite for deploying Kubernetes applications locally. ```bash $ minikube start --memory 5120 --cpus=4 ``` -------------------------------- ### Install Frontend Dependencies (npm) Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Installs Node.js dependencies for the frontend. `npm ci` is recommended for CI environments for faster, more reliable installs. ```bash npm install ``` ```bash npm ci ``` -------------------------------- ### Install Kubectl-Diagrams via Nix Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Provides the command to install the `kubectl-diagrams` plugin using Nix, a package manager. ```sh nix shell github:philippemerle/KubeDiagrams#kubectl-diagrams ``` -------------------------------- ### Start Minikube Cluster Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/zookeeper/README.md Starts a minikube cluster with 4 nodes. This is a prerequisite for deploying the ZooKeeper application. ```bash $ minikube start --node 4 ``` -------------------------------- ### Navigate to Frontend Directory Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Change the current directory to the frontend folder to manage its setup. ```bash cd frontend ``` -------------------------------- ### Add Kubernetes Manifest Example Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/frontend/public/examples/README.md To add a new Kubernetes manifest example, create a YAML file in the 'manifests/' directory and register it in 'src/examples/registry.js' within the MANIFEST_EXAMPLES array. ```javascript const MANIFEST_EXAMPLES = [ // ...existing examples { id: 'my-example', name: 'My Example', description: 'Description of my example', filePath: '/examples/manifests/my-example.yaml' } ]; ``` -------------------------------- ### Navigate to Backend Directory Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Change the current directory to the backend folder to manage its setup. ```bash cd backend ``` -------------------------------- ### Enter Nix Development Environment Source: https://github.com/philippemerle/kubediagrams/blob/main/CONTRIBUTING.md Use this command to enter the Nix development environment if you have Nix installed. ```bash nix develop ``` -------------------------------- ### Install Kubectl-Diagrams Plugin Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Shows how to make the `kubectl-diagrams` script available in your system's PATH by creating a symbolic link. Ensure `kube-diagrams` is also on your PATH. ```sh ln -s $(which kubectl-diagrams) /usr/local/bin/kubectl-diagrams ``` -------------------------------- ### Start Flask Backend Server Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Runs the Flask development server. The backend will be accessible at `http://localhost:5000`. ```bash python3 app.py ``` -------------------------------- ### Install KubeDiagrams using pip Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Installs KubeDiagrams and its Python dependencies using pip. Ensure Python 3.9 or higher is installed. ```bash pip install KubeDiagrams ``` -------------------------------- ### Add Helm Chart Example Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/frontend/public/examples/README.md Helm chart examples are added by providing a URL to the chart in 'src/examples/registry.js' within the HELM_CHART_EXAMPLES array. No separate files are needed. ```javascript const HELM_CHART_EXAMPLES = [ // ...existing examples { id: 'my-chart', name: 'My Chart', description: 'Description of my chart', url: 'https://charts.example.com/my-chart' } ]; ``` -------------------------------- ### Install KubeDiagrams using Nix Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Installs KubeDiagrams using the Nix package manager. This command fetches the latest version from the GitHub repository. ```bash nix shell github:philippemerle/KubeDiagrams ``` -------------------------------- ### Generate Kubernetes Architecture Diagrams Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/gateway-api/README.md Run this script to generate architecture diagrams for Gateway API examples. Ensure you are in the project root directory. ```sh ./generate.sh ``` -------------------------------- ### Start KubeDiagrams with Docker Compose (Bash) Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Start the KubeDiagrams web application using Docker Compose. This command runs the application in detached mode. ```bash docker compose up -d ``` -------------------------------- ### Generate DeathStarBench Architecture Diagrams Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/deathstarbench/README.md Execute this script to generate all Kubernetes architecture diagrams for the DeathStarBench example. Ensure you are in the project's root directory. ```sh $ generate.sh ``` -------------------------------- ### Generate Diagram from Default Namespace using Docker Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Capture the current state of all resources in the default namespace using `kubectl get all` and pipe it to Kubediagrams Docker for diagram creation. ```sh kubectl get all -o yaml | docker run -v "$(pwd)":/work -i philippemerle/kubediagrams kube-diagrams -o default-namespace.png - ``` -------------------------------- ### Clone KubeDiagrams Repository (Bash) Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Clone the KubeDiagrams repository to your local machine. This is the first step for both Docker Compose and Minikube installations. ```bash git clone https://github.com/philippemerle/KubeDiagrams.git cd KubeDiagrams/webapp ``` -------------------------------- ### Generate Diagram from All Namespaces using Docker Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Generate a diagram of all workload and service resources across all namespaces by piping `kubectl get all --all-namespaces` to Kubediagrams Docker. ```sh kubectl get all --all-namespaces -o yaml | docker run -v "$(pwd)":/work -i philippemerle/kubediagrams kube-diagrams -o all-namespaces.png - ``` -------------------------------- ### Generate Diagram from All Namespaces Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Generates a PNG diagram representing all workload and service resources across all Kubernetes namespaces. It uses `kubectl get all --all-namespaces`. ```sh # generate a diagram of all workload and service resources from all namespaces kubectl get all --all-namespaces -o yaml | kube-diagrams -o all-namespaces.png - ``` -------------------------------- ### Use KubeDiagrams as Kubectl Plugin Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Demonstrates how to use KubeDiagrams directly within `kubectl` commands after installation. This provides a more integrated workflow. ```sh kubectl diagrams all -o diagram.png ``` -------------------------------- ### Get All Kubernetes Resources Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/cassandra/README.md Retrieves all Kubernetes resources (including PVCs, ServiceAccounts, ConfigMaps, PVs, and StorageClasses) in the default namespace and outputs them in YAML format to a file named default.yml. ```bash $ kubectl get all,pvc,serviceaccount,configmap,pv,storageclass -o=yaml > default.yml ``` -------------------------------- ### Generate Diagram from Default Namespace State Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Visualizes the current state of all resources in the default Kubernetes namespace by piping `kubectl get all` output to `kube-diagrams`. ```sh # generate a diagram from the actual default namespace state kubectl get all -o yaml | kube-diagrams -o default-namespace.png - ``` -------------------------------- ### Get All Kubernetes Resources Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/zookeeper/README.md Retrieves all Kubernetes resources in the 'default' namespace and outputs them in YAML format to a file named 'namespace_default.yml'. This is used for generating a diagram of the deployed instance. ```bash $ kubectl get all,sa,cm,pdb,pvc,pv,sc -o=yaml > namespace_default.yml ``` -------------------------------- ### Build Frontend for Production Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Use this command to build the frontend application for production deployment. Ensure you are in the 'frontend' directory. ```bash cd frontend npm run build ``` -------------------------------- ### Create and Activate Virtual Environment (Python) Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Sets up an isolated Python environment for backend dependencies. Use `venv\Scripts\activate` on Windows. ```bash python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate ``` -------------------------------- ### Activate Backend Virtual Environment Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Activate the Python virtual environment for the backend. Ensure you are in the 'backend' directory. ```bash cd backend source venv/bin/activate ``` -------------------------------- ### Stop KubeDiagrams with Docker Compose (Bash) Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Stop the KubeDiagrams web application services that were started with Docker Compose. ```bash docker compose down ``` -------------------------------- ### Mermaid Diagram Code Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md This is the Mermaid code generated by KubeDiagrams for the WordPress example. It defines the structure and relationships between Kubernetes resources. ```mermaid flowchart TB subgraph Namespace_default [Namespace: default] direction TB style Namespace_default fill:white,color:#2D3436,font:sans-serif,font-size:12pt,stroke:black,stroke-dasharray:4 subgraph Application_wordpress [Application: wordpress] direction TB style Application_wordpress fill:#ECE8F6,color:#2D3436,font:sans-serif,font-size:12pt,stroke:#AEB6BE 309b7a6a980d471ab77463b5b100daf4@{ img: "https://raw.githubusercontent.com/mingrammer/diagrams/refs/heads/master/resources/k8s/network/svc.png", label: "wordpress-mysql", h: 120, constraint: "on" } style 309b7a6a980d471ab77463b5b100daf4 fill:none,stroke:none 418cdbdf8b6e4c15808f6790ca468518@{ img: "https://raw.githubusercontent.com/mingrammer/diagrams/refs/heads/master/resources/k8s/storage/pvc.png", label: "mysql-pv-claim", h: 120, constraint: "on" } style 418cdbdf8b6e4c15808f6790ca468518 fill:none,stroke:none 86aea62b4d7e4855b53c90a845137ac1@{ img: "https://raw.githubusercontent.com/mingrammer/diagrams/refs/heads/master/resources/k8s/compute/deploy.png", label: "wordpress-mysql", h: 120, constraint: "on" } style 86aea62b4d7e4855b53c90a845137ac1 fill:none,stroke:none a86b1243aba448808bb39f896fa92ed6@{ img: "https://raw.githubusercontent.com/mingrammer/diagrams/refs/heads/master/resources/k8s/podconfig/secret.png", label: "mysql-pass", h: 120, constraint: "on" } style a86b1243aba448808bb39f896fa92ed6 fill:none,stroke:none ace15327f7724ee89433abe9c08c81b2@{ img: "https://raw.githubusercontent.com/mingrammer/diagrams/refs/heads/master/resources/k8s/network/svc.png", label: "wordpress", h: 120, constraint: "on" } style ace15327f7724ee89433abe9c08c81b2 fill:none,stroke:none 31f2b483d2c646f890233c302438cb84@{ img: "https://raw.githubusercontent.com/mingrammer/diagrams/refs/heads/master/resources/k8s/storage/pvc.png", label: "wp-pv-claim", h: 120, constraint: "on" } style 31f2b483d2c646f890233c302438cb84 fill:none,stroke:none efa901d5916f4a6b8f0b56c88ac08b73@{ img: "https://raw.githubusercontent.com/mingrammer/diagrams/refs/heads/master/resources/k8s/compute/deploy.png", label: "wordpress", h: 120, constraint: "on" } style efa901d5916f4a6b8f0b56c88ac08b73 fill:none,stroke:none end end 309b7a6a980d471ab77463b5b100daf4 -- "3306/TCP" --> 86aea62b4d7e4855b53c90a845137ac1 linkStyle 0 stroke:black,color:#2D3436,font:sans-serif,font-size:10pt,stroke-dasharray:4 86aea62b4d7e4855b53c90a845137ac1 --> 418cdbdf8b6e4c15808f6790ca468518 linkStyle 1 stroke:black,color:#2D3436,font:sans-serif,font-size:13pt 86aea62b4d7e4855b53c90a845137ac1 --> a86b1243aba448808bb39f896fa92ed6 linkStyle 2 stroke:black,color:#2D3436,font:sans-serif,font-size:13pt ace15327f7724ee89433abe9c08c81b2 -- "80/TCP" --> efa901d5916f4a6b8f0b56c88ac08b73 linkStyle 3 stroke:black,color:#2D3436,font:sans-serif,font-size:10pt,stroke-dasharray:4 efa901d5916f4a6b8f0b56c88ac08b73 --> a86b1243aba448808bb39f896fa92ed6 linkStyle 4 stroke:black,color:#2D3436,font:sans-serif,font-size:13pt efa901d5916f4a6b8f0b56c88ac08b73 --> 31f2b483d2c646f890233c302438cb84 linkStyle 5 stroke:black,color:#2D3436,font:sans-serif,font-size:13pt ``` -------------------------------- ### Generate Diagram from Manifest File Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Creates a PNG diagram named 'cassandra.png' from a single Kubernetes manifest file. ```sh # generate a diagram from a manifest kube-diagrams -o cassandra.png examples/cassandra/cassandra.yml ``` -------------------------------- ### KubeDiagrams CLI Help Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Displays the help message and available options for the `kube-diagrams` command. Use this to understand all possible configurations. ```sh kube-diagrams -h usage: kube-diagrams [-h] [-o OUTPUT] [-f FORMAT] [-c CONFIG] [-v] [--without-namespace] filename [filename ...] Generate Kubernetes architecture diagrams from Kubernetes manifest files positional arguments: filename the Kubernetes manifest filename to process options: -h, --help show this help message and exit -o, --output OUTPUT output diagram filename -f, --format FORMAT output format, allowed formats are d2, dot, dot_json, drawio, gif, jp2, jpe, jpeg, jpg, mermaid, pdf, png, svg, tif, tiff, set to png by default --embed-all-icons embed all icons into svg or dot_json output diagrams -c, --config CONFIG custom kube-diagrams configuration file -n, --namespace NAMESPACE visualize only the resources inside a given namespace -v, --verbose verbosity, set to false by default --without-namespace disable namespace cluster generation ``` -------------------------------- ### Deploy Cassandra Application Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/cassandra/README.md Applies the Cassandra Kubernetes configuration to deploy the application. ```bash $ kubectl apply -f cassandra.yml ``` -------------------------------- ### Display Helm-Diagrams Help Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md View the help message for the `helm-diagrams` command to see all available options and flags. ```sh helm-diagrams --help ``` -------------------------------- ### Run Frontend ESLint Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Use this command to run ESLint for code linting on the frontend. Ensure you are in the 'frontend' directory. ```bash cd frontend npm run lint ``` -------------------------------- ### Generate Docker Open5GS Diagrams Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/docker-open5gs/README.md Run this script to generate the Kubernetes architecture diagrams for the docker-open5gs Helm charts. ```sh #!/bin/bash # This script generates Kubernetes architecture diagrams for the docker-open5gs Helm charts. # It assumes you have kubediagrams installed and configured. # Define the Helm chart directory for docker-open5gs HELM_CHART_DIR="./charts/open5gs" # Define the output directory for the diagrams OUTPUT_DIR="./diagrams" # Create the output directory if it doesn't exist mkdir -p "$OUTPUT_DIR" # Generate the diagram with namespace # The --namespace flag is used to include namespace information in the diagram. # The --output flag specifies the output file path. # The --chart flag specifies the Helm chart directory. # The --name flag specifies the name of the diagram. kubediagrams --namespace --output "$OUTPUT_DIR/open5gs.png" --chart "$HELM_CHART_DIR" --name "open5gs" # Generate the diagram without namespace # This command generates the diagram without including namespace information. kubediagrams --output "$OUTPUT_DIR/open5gs-without-namespace.png" --chart "$HELM_CHART_DIR" --name "open5gs-without-namespace" echo "Kubernetes architecture diagrams generated successfully in $OUTPUT_DIR" ``` -------------------------------- ### Format Frontend Code with Prettier Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Use this command to format the frontend code using Prettier. Ensure you are in the 'frontend' directory. ```bash cd frontend npm run format ``` -------------------------------- ### Generate Open5GS Kubernetes Diagram Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/open5gs-k8s/README.md Run this script to generate the Kubernetes architecture diagram for open5gs-k8s manifests. ```sh #!/bin/bash # This script generates the Kubernetes architecture diagram for open5gs-k8s manifests. # It uses the kubediagrams tool to process the Kubernetes YAML files. # Define the input directory containing the Kubernetes manifests INPUT_DIR="./" # Define the output file name for the diagram OUTPUT_FILE="open5gs-k8s-diagram.png" # Check if kubediagrams is installed if ! command -v kubediagrams &> /dev/null then echo "kubediagrams could not be found. Please install it first." exit 1 fi # Generate the diagram echo "Generating diagram for Open5GS Kubernetes manifests..." kubediagrams --input $INPUT_DIR --output $OUTPUT_FILE if [ $? -eq 0 ] then echo "Successfully generated diagram: $OUTPUT_FILE" else echo "Failed to generate diagram." exit 1 fi ``` -------------------------------- ### Access KubeDiagrams Frontend on Minikube (Bash) Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Expose the KubeDiagrams frontend service running on Minikube to access it via a web browser. This command opens the service in a new tab. ```bash minikube service -n kube-diagrams frontend ``` -------------------------------- ### Generate Diagram from Kustomize Folder Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Generates a PNG diagram from resources defined in a Kustomize folder. It pipes the output of `kubectl kustomize` to `kube-diagrams`. ```sh # generate a diagram from a kustomize folder kubectl kustomize path_to_a_kustomize_folder | kube-diagrams - -o diagram.png ``` -------------------------------- ### Deploy WordPress Application Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/wordpress/README.md Apply the Kubernetes manifests to deploy the WordPress application. Ensure mysql-pass.yaml is applied first. ```sh $ kubectl apply -f mysql-pass.yaml $ kubectl apply -f mysql-deployment.yaml $ kubectl apply -f wordpress-deployment.yaml ``` -------------------------------- ### Kubernetes and Orchestration Structure Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Details the Kubernetes manifests for deployment and the Docker Compose file for orchestration. ```tree ├── kubernetes/ └── kube-diagrams-webapp.yaml # Manifests for deploying KubeDiagrams WebApp │ ├── build-and-push-images.sh # Script to build and push both frontend and backend container images └── docker-compose.yml # Docker Compose orchestration ``` ``` -------------------------------- ### Generate Diagram from Kustomize Folder using Docker Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Pipe the output of `kubectl kustomize` into the Kubediagrams Docker container to generate a diagram from a Kustomize directory. ```sh kubectl kustomize path_to_a_kustomize_folder | docker run -v "$(pwd)":/work -i philippemerle/kubediagrams kube-diagrams - -o diagram.png ``` -------------------------------- ### Generate Diagram for cassandra.yml Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/cassandra/README.md Use kube-diagrams to generate a Kubernetes architecture diagram from a cassandra.yml configuration file. ```bash $ kube-diagrams cassandra.yml ``` -------------------------------- ### Deploy KubeDiagrams with Minikube (Bash) Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Deploy the KubeDiagrams web application to a Minikube cluster. This command applies the Kubernetes configuration file. ```bash kubectl apply -f kubernetes/kube-diagrams-webapp.yaml ``` -------------------------------- ### Backend Project Structure Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Details the organization of the Python/Flask backend, including routes, services, utilities, and configuration files. ```tree webapp/ ├── backend/ # Python/Flask backend │ ├── routes/ # Flask route handlers │ │ ├── manifest.py # Manifest diagram generation endpoints │ │ ├── helm.py # Helm chart diagram endpoints │ │ ├── helmfile.py # Helmfile diagram endpoints │ │ ├── cluster.py # Cluster diagram endpoints │ │ └── submit.py # Feedback submission endpoint │ ├── services/ # Business logic layer │ │ ├── manifestService.py # Manifest processing service │ │ ├── helmService.py # Helm processing service │ │ ├── helmfileService.py # Helmfile processing service │ │ ├── clusterService.py # Cluster processing service │ │ ├── file_manager.py # File operations manager │ │ └── models.py # Data models │ ├── utils/ # Utility modules │ │ ├── access_logger.py # Request logging │ │ ├── logger.py # General logging │ │ ├── response_builder.py # API response builder │ │ └── validators.py # Input validation │ ├── app.py # Flask application entry point │ ├── config.py # Configuration settings │ ├── constants.py # Global constants │ ├── requirements.txt # Python dependencies │ ├── Dockerfile # Backend Docker image │ └── logs/ # Log files (auto-rotation) │ ``` -------------------------------- ### Generate Diagram from Helmfile Descriptor Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Creates a PNG diagram from a Helmfile descriptor by piping the templated Helm output to `kube-diagrams`. ```sh # generate a diagram from a helmfile descriptor helmfile template -f helmfile.yaml | kube-diagrams - -o diagram.png ``` -------------------------------- ### Generate WordPress Kubernetes Architecture Diagram Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/wordpress/README.md Use this command to generate the Kubernetes architecture diagram for WordPress manifests. ```sh $ kube-diagrams -o wordpress *.yaml ``` -------------------------------- ### Generate Diagram from Manifest Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Generates a diagram from a provided Kubernetes manifest file. ```APIDOC ## POST /api/manifest/generate ### Description Generate diagram from manifest ### Method POST ### Endpoint /api/manifest/generate ``` -------------------------------- ### Generate Diagram from Local Helm Chart Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Create a diagram for a Helm chart located in a local directory. ```sh helm-diagrams some-path/some-chart ``` -------------------------------- ### Generate free5gc-k8s Architecture Diagram Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/free5gc-k8s/README.md Execute this shell command to generate the Kubernetes architecture diagram for free5gc-k8s manifests. Ensure you are in the project's root directory. ```sh $ ./generate.sh ``` -------------------------------- ### Generate Default Namespace Diagram Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/zookeeper/README.md Generates an architecture diagram for the default namespace using the previously saved resource YAML file. ```bash $ kube-diagrams namespace_default.yml ``` -------------------------------- ### Generate Diagram from Manifest using Docker Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Use the Kubediagrams Docker image to generate a diagram from a Kubernetes manifest file. Mount the current directory to access local files. ```sh docker run -v "$(pwd)":/work philippemerle/kubediagrams kube-diagrams -o cassandra.png examples/cassandra/cassandra.yml ``` -------------------------------- ### Generate Helmfile Architecture Diagram Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/helmfile/README.md Use this command to generate a PNG architecture diagram from your helmfile.yaml. The output of `helmfile template` is piped to `kube-diagrams` for processing. ```bash $ helmfile template -f helmfile.yaml | kube-diagrams - -o helmfile.png ``` -------------------------------- ### Generate Diagram from Helmfile using Docker Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Use `helmfile template` to generate Helm manifests and pipe them into the Kubediagrams Docker container for diagram generation. ```sh helmfile template -f helmfile.yaml | docker run -v "$(pwd)":/work -i philippemerle/kubediagrams kube-diagrams - -o diagram.png ``` -------------------------------- ### Generate Diagram for Default Namespace Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/cassandra/README.md Generates a Kubernetes architecture diagram for the default namespace using the collected resource information from default.yml. ```bash $ kube-diagrams default.yml ``` -------------------------------- ### Frontend Project Structure Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Details the organization of the React/Vite frontend, including components, services, public assets, and configuration files. ```tree ├── frontend/ # React/Vite frontend │ ├── src/ │ │ ├── components/ │ │ │ ├── common/ │ │ │ ├── options/ │ │ │ └── tabs/ │ │ │ ├── ManifestTab/ │ │ │ ├── HelmTab/ │ │ │ ├── HelmFileTab/ │ │ │ ├── ClusterTab/ │ │ │ └── InteractiveViewerTab/ │ │ ├── examples/ │ │ ├── hooks/ │ │ ├── services/ │ │ ├── utils/ │ │ ├── App.jsx # Main application component │ │ └── main.jsx # Application entry point │ ├── public/ │ │ ├── examples/ │ │ │ ├── manifests/ │ │ │ └── helmfiles/ │ │ └── interactive_viewer/ │ ├── package.json # NPM dependencies │ ├── vite.config.js # Vite configuration │ ├── apache.conf # Apache reverse proxy config │ └── Dockerfile # Frontend Docker image │ ``` -------------------------------- ### Mermaid Diagram for WordPress Manifests Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/wordpress/README.md This Mermaid diagram visualizes the architecture of a WordPress deployment, including its dependencies on MySQL, persistent volumes, and secrets. It outlines the services, deployments, and persistent volume claims involved. ```mermaid flowchart TB subgraph cluster_Namespace_default [Namespace: default] direction TB style cluster_Namespace_default fill:white,color:#2D3436,font:sans-serif,font-size:12pt,stroke:black,stroke-dasharray:7 7 subgraph cluster_Application_wordpress [Application: wordpress] direction TB style cluster_Application_wordpress fill:#ECE8F6,color:#2D3436,font:sans-serif,font-size:12pt,stroke:#AEB6BE 216e17e905a74ecab47679c7e9f78366@{ img: "https://raw.githubusercontent.com/mingrammer/diagrams/refs/heads/master/resources/k8s/network/svc.png", label: "wordpress-mysql", h: 120, constraint: "on" } style 216e17e905a74ecab47679c7e9f78366 fill:none,stroke:none 3fb470b48c5245ee828fe4eee608156c@{ img: "https://raw.githubusercontent.com/mingrammer/diagrams/refs/heads/master/resources/k8s/compute/deploy.png", label: "wordpress-mysql", h: 120, constraint: "on" } style 3fb470b48c5245ee828fe4eee608156c fill:none,stroke:none 2beb29e6801844f7b75bdad8cc14a954@{ img: "https://raw.githubusercontent.com/mingrammer/diagrams/refs/heads/master/resources/k8s/storage/pvc.png", label: "mysql-pv-claim", h: 120, constraint: "on" } style 2beb29e6801844f7b75bdad8cc14a954 fill:none,stroke:none 229d70702cef4b17b7dd10bac78ec16b@{ img: "https://raw.githubusercontent.com/mingrammer/diagrams/refs/heads/master/resources/k8s/podconfig/secret.png", label: "mysql-pass", h: 120, constraint: "on" } style 229d70702cef4b17b7dd10bac78ec16b fill:none,stroke:none 2ce3d64c9c1445ddb643d5873090eda0@{ img: "https://raw.githubusercontent.com/mingrammer/diagrams/refs/heads/master/resources/k8s/network/svc.png", label: "wordpress", h: 120, constraint: "on" } style 2ce3d64c9c1445ddb643d5873090eda0 fill:none,stroke:none cd5450adc3ad4e50a0493e63a0b30662@{ img: "https://raw.githubusercontent.com/mingrammer/diagrams/refs/heads/master/resources/k8s/compute/deploy.png", label: "wordpress", h: 120, constraint: "on" } style cd5450adc3ad4e50a0493e63a0b30662 fill:none,stroke:none 55791b4ba88547edba17552292b35fa2@{ img: "https://raw.githubusercontent.com/mingrammer/diagrams/refs/heads/master/resources/k8s/storage/pvc.png", label: "wp-pv-claim", h: 120, constraint: "on" } style 55791b4ba88547edba17552292b35fa2 fill:none,stroke:none end end 216e17e905a74ecab47679c7e9f78366 -- "3306/TCP" --> 3fb470b48c5245ee828fe4eee608156c linkStyle 0 stroke:black,color:#2D3436,font:sans-serif,font-size:10pt,stroke-dasharray:7 7 3fb470b48c5245ee828fe4eee608156c --> 2beb29e6801844f7b75bdad8cc14a954 linkStyle 1 stroke:black,color:#2D3436,font:sans-serif,font-size:13pt 3fb470b48c5245ee828fe4eee608156c --> 229d70702cef4b17b7dd10bac78ec16b linkStyle 2 stroke:black,color:#2D3436,font:sans-serif,font-size:13pt 2ce3d64c9c1445ddb643d5873090eda0 -- "80/TCP" --> cd5450adc3ad4e50a0493e63a0b30662 linkStyle 3 stroke:black,color:#2D3436,font:sans-serif,font-size:10pt,stroke-dasharray:7 7 cd5450adc3ad4e50a0493e63a0b30662 --> 229d70702cef4b17b7dd10bac78ec16b linkStyle 4 stroke:black,color:#2D3436,font:sans-serif,font-size:13pt cd5450adc3ad4e50a0493e63a0b30662 --> 55791b4ba88547edba17552292b35fa2 linkStyle 5 stroke:black,color:#2D3436,font:sans-serif,font-size:13pt ``` -------------------------------- ### Generate Diagram from Helmfile Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Generates a diagram from a provided Helmfile. ```APIDOC ## POST /api/helmfile/generate ### Description Generate diagram from Helmfile ### Method POST ### Endpoint /api/helmfile/generate ``` -------------------------------- ### Generate Kube Prometheus Stack Diagram Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/kube-prometheus-stack/README.md Use the helm-diagrams CLI to generate the architecture diagram for the Kube Prometheus Stack Helm Chart. This command fetches the chart from the specified URL. ```sh $ helm-diagrams -c monitoring.coreos.com.kdc https://prometheus-community.github.io/helm-charts/kube-prometheus-stack ``` -------------------------------- ### Generate ZooKeeper Diagram Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/zookeeper/README.md Use this command to generate an architecture diagram from the ZooKeeper Kubernetes manifest file. ```bash $ kube-diagrams zookeeper.yaml ``` -------------------------------- ### Generate Diagram from OCI Helm Chart using Docker Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Use the Kubediagrams Docker image to generate a diagram for an Argo CD Helm chart from an OCI repository. ```sh docker run -v "$(pwd)":/work philippemerle/kubediagrams helm-diagrams oci://ghcr.io/argoproj/argo-helm/argo-cd ``` -------------------------------- ### View Docker Compose Service Logs Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Displays the logs from all running services. The `-f` flag follows the log output in real-time. ```bash docker compose logs -f ``` -------------------------------- ### Generate Diagram from Helm Chart URL Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Use `helm-diagrams` to create a diagram from a Helm chart hosted at a URL. Specify the output file and format. ```sh helm-diagrams https://charts.jetstack.io/cert-manager -o diagram.png ``` ```sh helm-diagrams https://charts.jetstack.io/cert-manager --set crds.enabled=true -o cert-manager.png ``` -------------------------------- ### Generate Internal Workload Diagrams with KubeDiagrams Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/inside-workloads/README.md Use this command to generate diagrams showing the internal structure of workloads, referencing a specific configuration file. ```sh kube-diagrams -c inside-workloads.kdc ``` -------------------------------- ### Deploy ZooKeeper Application Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/zookeeper/README.md Applies the ZooKeeper Kubernetes manifest to deploy the application to the cluster. ```bash $ kubectl apply -f zookeeper.yaml ``` -------------------------------- ### Generate Diagram from Live Cluster Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Generates a diagram from the current live Kubernetes cluster. ```APIDOC ## POST /api/cluster/generate ### Description Generate diagram from live cluster ### Method POST ### Endpoint /api/cluster/generate ``` -------------------------------- ### Generate Diagram from OCI Helm Chart Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Generate a diagram for an Argo CD Helm chart available in an OCI repository. ```sh helm-diagrams oci://ghcr.io/argoproj/argo-helm/argo-cd -f svg ``` -------------------------------- ### Generate Internal Workload Diagrams with Helm-Diagrams Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/inside-workloads/README.md Use this command to generate diagrams showing the internal structure of workloads from a Helm chart URL, referencing a specific configuration file. ```sh helm-diagrams -c inside-workloads.kdc ``` -------------------------------- ### Generate Kubernetes Diagram in GitHub Action Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Use this snippet to generate a diagram from a Kubernetes manifest file within a GitHub Action workflow. Specify the type as 'kubernetes' and provide the output file and input manifest path. ```yaml name: "Your GitHub Action Name" on: workflow_dispatch: jobs: test: runs-on: ubuntu-latest steps: - name: "Generate diagram from Kubernetes manifest" uses: philippemerle/KubeDiagrams@main with: type: "kubernetes" args: "-o examples/cassandra/cassandra.png examples/cassandra/cassandra.yml" ``` -------------------------------- ### Generate Diagram from Helm Chart URL using Docker Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Use the Kubediagrams Docker image to generate a diagram from a Helm chart URL, similar to the CLI usage. ```sh docker run -v "$(pwd)":/work philippemerle/kubediagrams helm-diagrams https://charts.jetstack.io/cert-manager ``` -------------------------------- ### Generate D2 Diagram Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Use this command to generate a D2 diagram from Kubernetes YAML files. The output is saved to a .d2 file. ```sh kube-diagrams examples/wordpress/*.yaml -o wordpress.d2 ``` -------------------------------- ### Generate Diagram Hiding ReplicaSet Objects Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/wordpress/README.md Generate a Kubernetes architecture diagram for the default namespace while excluding ReplicaSet objects using a custom configuration file. ```sh $ kube-diagrams -c hide_replicaset.kd -o namespace_default_without_replicaset.png namespace_default.yml ``` -------------------------------- ### Generate Mermaid Diagram Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Use this command to generate a Mermaid diagram from Kubernetes YAML files. The output is saved to a .mermaid file. ```sh kube-diagrams examples/wordpress/*.yaml -o wordpress.mermaid ``` -------------------------------- ### Kubernetes Access Log Format Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md The backend generates access logs in Apache Combined Log format. This format is compatible with analysis tools like GoAccess. ```text IP - - [datetime] "METHOD PATH PROTOCOL" STATUS SIZE "REFERER" "USER-AGENT" TIME_MS ``` -------------------------------- ### Generate Custom Diagram for AWS EKS Deployment Source: https://github.com/philippemerle/kubediagrams/blob/main/examples/wordpress/README.md Generate a custom Kubernetes architecture diagram, specifying a custom configuration file and output name, to represent a WordPress application deployed in AWS EKS. ```sh $ kube-diagrams -c custom_diagram.kd -o wordpress_deployed_in_aws_eks namespace_default.yml ``` -------------------------------- ### Generate Helm Chart Diagram in GitHub Action Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md This snippet demonstrates how to generate a diagram from a Helm chart URL in a GitHub Action. Set the type to 'helm' and provide the Helm chart repository URL as an argument. ```yaml name: "Your GitHub Action Name" on: workflow_dispatch: jobs: test: runs-on: ubuntu-latest steps: - name: "Generate diagram from Helm chart" uses: philippemerle/KubeDiagrams@main with: type: "helm" args: "https://charts.jetstack.io/cert-manager" ``` -------------------------------- ### Generate Diagram from Helm Chart Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/README.md Generates a diagram from a provided Helm chart. ```APIDOC ## POST /api/helm/generate ### Description Generate diagram from Helm chart ### Method POST ### Endpoint /api/helm/generate ``` -------------------------------- ### Generate drawio Diagram Source: https://github.com/philippemerle/kubediagrams/blob/main/README.md Use this command to generate a diagram in drawio format from YAML files. This format can be opened with draw.io or other diagram editors. ```sh kube-diagrams examples/wordpress/*.yaml -o wordpress.drawio ``` -------------------------------- ### Autoload Diagram via URL Parameter Source: https://github.com/philippemerle/kubediagrams/blob/main/webapp/frontend/public/interactive_viewer/index.html This code snippet demonstrates how to automatically load a diagram JSON from a URL parameter named 'dataUrl'. It fetches the JSON and passes it to the `renderFromDotJson` function if available. ```javascript (function () { const params = new URLSearchParams(location.search); const dataUrl = params.get('dataUrl'); if (dataUrl) { fetch(dataUrl) .then(r => r.json()) .then(json => { if (typeof window.renderFromDotJson === 'function') { window.renderFromDotJson(json); } else { console.warn('renderFromDotJson(json) is not defined.'); } }) .catch(err => console.error('Failed to load DOT_JSON via dataUrl:', err)); } })(); ```