Sign inSign up

devopsiaci/simple-krr-dashboard

By devopsiaci

Updated 19 days ago

Image
0

3.4K

devopsiaci/simple-krr-dashboard repository overview

simple-krr-dashboard

Note

This project is not affiliated with [robusta-dev/krr](https://github.com/robusta-dev/krr).

Simple KRR dashboard for Kubernetes resource reporting, using robusta-dev/krr to gather data.

simple-dashboard-demo

Requirements

Installation

Data Collection

The dashboard uses data generated by krr using the following command:

krr simple --fileoutput report.table.csv --use-oomkill-data --formatter csv
Local Installation
  1. Clone the repository

  2. Create and activate a virtual environment:

    python -m venv .venv
    source .venv/bin/activate  # On Unix/macOS
    # or
    .venv\Scripts\activate  # On Windows
    
  3. Install dependencies:

    pipenv install
    
Docker Installation
  1. Build the Docker image:

    docker build -t simple-krr-dashboard .
    
  2. Run the container:

    docker run -v $(pwd)/reports:/reports -p 8080:8080 simple-krr-dashboard
    

The dashboard will be available at http://localhost:8080

Usage

Local Usage

To run the dashboard:

pipenv run start

Or directly using Python (make sure you're in the project root directory):

PYTHONPATH=src python src/simple_krr_dashboard/main.py
Docker Usage

The Docker container exposes port 8080 for the web interface (Gunicorn). You can access the dashboard by opening your web browser and navigating to http://localhost:8080

Development Commands

# Run tests
pipenv run test

# Run linter
pipenv run lint

# Format code
pipenv run format

# Type checking
pipenv run typecheck

Environment Variables

The following environment variables can be used to configure the application:

VariableDescriptionDefaultRequired
APP_NAMEName of the application"Simple KRR Dashboard"No
APP_ROOTURL prefix for the application (context root)"/"No
APP_VERSIONVersion of the application"1.0.0"No
KUBERNETES_CLUSTER_NAMEName of the Kubernetes clusterNoneNo
KUBERNETES_DASHBOARD_CSV_PATHPath to the CSV file containing Kubernetes data"/reports/report.table.csv"No
LOG_LEVELLogging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)"INFO"No
LOG_FORMATFormat string for log messages"%(asctime)s - %(name)s - %(levelname)s - %(message)s"No
LOG_OUTPUT_FORMATLog output format (text, logfmt)"text"No
DISABLE_HTTP_LOGSDisable HTTP access logs from Gunicorn"false"No
Logging Configuration

The application uses two types of logs:

  1. Application Logs: Controlled by LOG_LEVEL (DEBUG, INFO, WARNING, ERROR, CRITICAL) and LOG_OUTPUT_FORMAT (text, logfmt)
  2. HTTP Access Logs: Controlled by DISABLE_HTTP_LOGS (true/false)
Log Output Formats

The application supports two log output formats:

Text Format (Default)

Human-readable text format suitable for development and debugging.

docker run -v $(pwd)/reports:/reports -p 8080:8080 -e LOG_OUTPUT_FORMAT=text simple-krr-dashboard

Example output:

2025-12-12 20:30:45,123 - simple_krr_dashboard.main - INFO - Starting application
2025-12-12 20:30:45,456 - simple_krr_dashboard.data - WARNING - No cluster name configured
Logfmt Format

Machine-readable key-value format, ideal for log aggregation systems like Grafana Loki.

docker run -v $(pwd)/reports:/reports -p 8080:8080 -e LOG_OUTPUT_FORMAT=logfmt simple-krr-dashboard

Example output:

time=2025-12-12T20:30:45.123456 level=info logger=simple_krr_dashboard.main msg="Starting application"
time=2025-12-12T20:30:45.456789 level=warning logger=simple_krr_dashboard.data msg="No cluster name configured"
Configuration Examples

Disable HTTP access logs (recommended for production):

docker run -v $(pwd)/reports:/reports -p 8080:8080 -e DISABLE_HTTP_LOGS=true simple-krr-dashboard

Enable HTTP access logs (useful for debugging):

docker run -v $(pwd)/reports:/reports -p 8080:8080 -e DISABLE_HTTP_LOGS=false simple-krr-dashboard

Change application log level:

# Show only errors
docker run -v $(pwd)/reports:/reports -p 8080:8080 -e LOG_LEVEL=ERROR simple-krr-dashboard

# Show debug information
docker run -v $(pwd)/reports:/reports -p 8080:8080 -e LOG_LEVEL=DEBUG simple-krr-dashboard

Serve the dashboard under a custom path prefix:

# Dashboard available at http://localhost:8080/dashboard/
docker run -v $(pwd)/reports:/reports -p 8080:8080 -e APP_ROOT=/dashboard simple-krr-dashboard

Production-ready configuration with JSON logs:

docker run -v $(pwd)/reports:/reports -p 8080:8080 \
  -e LOG_LEVEL=INFO \
  -e LOG_OUTPUT_FORMAT=json \
  -e DISABLE_HTTP_LOGS=true \
  simple-krr-dashboard

Development configuration with detailed text logs:

docker run -v $(pwd)/reports:/reports -p 8080:8080 \
  -e LOG_LEVEL=DEBUG \
  -e LOG_OUTPUT_FORMAT=text \
  -e DISABLE_HTTP_LOGS=false \
  simple-krr-dashboard

Testing

The project uses pytest for testing. To run the tests:

  1. Install test dependencies:

    pipenv install --dev
    
  2. Run the tests:

    pipenv run pytest
    
  3. Run tests with coverage report:

    pipenv run pytest --cov=simple_krr_dashboard tests/
    
Test Structure

The tests are organized in the following structure:

tests/
├── __init__.py
├── conftest.py           # Common test fixtures
├── test_app.py          # Application tests
├── test_config.py       # Configuration tests
├── test_dashboard.py    # Dashboard component tests
├── test_data.py         # Data processing tests
├── test_logging.py      # Logging tests
└── test_utils.py        # Utility function tests
Writing Tests

When adding new features, please include corresponding tests. The project follows these testing guidelines:

  • Use pytest fixtures for common setup
  • Mock external dependencies (e.g., file system, data processing)
  • Test both success and error cases
  • Include docstrings for test functions
  • Use meaningful test names that describe the behavior being tested

Contributing

Please read the CONTRIBUTING.md file for details on our code of conduct and the process for submitting pull requests.

Tag summary

Content type

Image

Digest

sha256:4c625eff5

Size

62.5 MB

Last updated

19 days ago

docker pull devopsiaci/simple-krr-dashboard