Kafka UI

repository·master·Indexed 11 days ago

https://github.com/provectus/kafka-ui

An open-source web interface for monitoring and managing Apache Kafka clusters. Version 0.4.0 provides a dashboard for visualizing data flows, managing topics, consumer groups, and schemas, with support for Avro, JSON Schema, and Protobuf. It includes features for multi-cluster management, RBAC, OAuth 2.0 security, and integration with Schema Registry.

Tokens
3K
Snippets
10
Records
17
Agent score
95%

What's inside Kafka UI

  1. Monitor and manage Kafka clusters

    master

    Kafka UI provides a web-based interface to observe and manage Apache Kafka clusters. Key capabilities include:

    • Multi-Cluster Management: Monitor multiple clusters from a single dashboard.
    • Metrics Dashboard: Track performance metrics for Brokers, Topics, Partitions, Production, and Consumption.
    • Topic Management: Create, configure, and view topics, including partition counts and replication status.
    • Consumer Groups: View per-partition parked offsets and combined/per-partition lag.
    • Message Browsing: Inspect messages using JSON, plain text, or Avro encoding.
    • Schema Registry Support: Manage Avro®, JSON Schema, and Protobuf schemas.
    • Security: Implement OAuth 2.0 (Github/Gitlab/Google), Role-Based Access Control (RBAC), and data masking for sensitive information.
  2. Run E2E tests on a local Chrome browser

    master

    To bypass the Docker/Selenoid environment and run tests directly in your local Chrome browser, add the following VM option to your Run Configuration:

    -Dbrowser=local

    Expected Chrome Paths

    Ensure Chrome is installed at one of the following locations:

    • Linux: /usr/bin/google-chrome
    • Mac: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    • Windows (Vista and newer): C:\Users%USERNAME%\AppData\Local\Google\Chrome\Application\chrome.exe
    • Windows XP: %HOMEPATH%\Local Settings\Application Data\Google\Chrome\Application\chrome.exe
    -Dbrowser=local
  3. Install the Kafka-ui E2E automation suite

    master

    To set up the E2E UI automation environment, you need to clone the main repository, navigate to the E2E checks directory, and pull the required Selenoid Chrome image.

    Prerequisites

    • Docker & Docker-compose
    • Java (use aarch64 jdk if on M1/arm chips)
    • Maven
    git clone https://github.com/provectus/kafka-ui.git
    cd kafka-ui
    cd kafka-ui-e2e-checks
    docker pull selenoid/vnc_chrome:103.0
  4. Install and set up the Kafka UI React application

    master

    To set up the frontend development environment, ensure you have docker and nvm (with the Node.js version specified in .nvmrc) installed. Follow these steps to prepare the project:

    1. Navigate to the react app directory:
      cd ./kafka-ui-react-app
    2. Install pnpm globally:
      npm install -g pnpm
    3. Install project dependencies:
      pnpm install
    4. Generate API clients from the OpenAPI document:
      pnpm gen:sources
    cd ./kafka-ui-react-app
    npm install -g pnpm
    pnpm install
    pnpm gen:sources
  5. Run Kafka-ui E2E checks

    master

    Running the E2E checks involves two main steps: starting the required infrastructure via Docker Compose and then executing the Maven test suite.

    1. Start Infrastructure

    Run the following commands from the kafka-ui root directory to start the Selenoid environment and the E2E test containers:

    docker-compose -f kafka-ui-e2e-checks/docker/selenoid-local.yaml up -d
    docker-compose -f documentation/compose/e2e-tests.yaml up -d

    2. Execute Test Suites

    Use the Maven wrapper to run a specific test suite. Replace %s in the command below with one of the following suite names:

    • regression
    • sanity
    • smoke
    ./mvnw -Dsurefire.suiteXmlFiles='src/test/resources/%s.xml' -f 'kafka-ui-e2e-checks' test -Pprod
    # Example: Running the smoke test suite
    ./mvnw -Dsurefire.suiteXmlFiles='src/test/resources/smoke.xml' -f 'kafka-ui-e2e-checks' test -Pprod
  6. Explore Docker Compose configurations for Kafka UI

    master

    Kafka UI provides several pre-configured docker-compose.yaml files to support different deployment scenarios, including architecture types, security protocols, and proxy setups. Use these files as templates for your own deployments.

    Common Deployment Scenarios

    • Standard/Default: Use kafka-ui.yaml for a full setup with 2 Kafka clusters, Schema Registry, and Kafka Connect.
    • ARM64 (Apple Silicon): Use kafka-ui-arm64.yaml for Mac M1/M2/M3 architectures.
    • Security & Authentication:
      • TLS/SSL: Use kafka-ui-ssl.yml to connect to Kafka via TLS/SSL.
      • SASL: Use kafka-ui-sasl.yaml for SASL authentication.
      • Schema Registry Auth: Use kafka-cluster-sr-auth.yaml for Schema Registry with authentication.
      • Basic Auth: Use kafka-ui-auth-context.yaml for username/password authentication with a custom URL path.
      • OAuth2: Use oauth-cognito.yaml for OAuth2 integration with AWS Cognito.
    • Proxy & Networking:
      • Nginx: Use nginx-proxy.yaml to run the app behind an Nginx reverse proxy.
      • Traefik: Use traefik-proxy.yaml for Traefik-specific proxy configurations.
    • Monitoring & Observability:
      • JMX Secured: Use kafka-ui-jmx-secured.yml for Kafka's JMX with SSL and authentication.
      • Prometheus/JMX Exporter: Use kafka-ui-with-jmx-exporter.yaml to use Prometheus JMX exporters instead of standard JMX.
    • Development & Testing:
      • Local Development: Use kafka-clusters-only.yaml if you want to run Kafka clusters locally and only run Kafka UI via Docker.
      • End-to-End Tests: Use e2e-tests.yaml for a setup including various connectors (S3, GitHub, etc.) and Ksql functionality.
  7. Quick start with Docker (Demo run)

    master

    To quickly try out Kafka UI without a persistent setup, run the following Docker command. This enables dynamic configuration, allowing you to manage settings through the UI.

    Access the web interface at http://localhost:8080 after the container starts.

    docker run -it -p 8080:8080 -e DYNAMIC_CONFIG_ENABLED=true provectuslabs/kafka-ui
  8. Create new test cases in Qase.io via annotations

    master

    New test cases can be automatically synchronized to Qase.io by following a specific inheritance and annotation pattern. This uses a custom QaseCreateListener to handle metadata.

    Implementation Steps

    1. Create a new class in kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/qaseSuite/suit.
    2. Inherit the class from kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/qaseSuite/BaseQaseTest.java.
    3. Define a test method annotated with @Test and the required @QaseTitle.
    4. Define private void step methods annotated with @io.qase.api.annotation.Step and call them within your test method.

    Available Annotations

    • @Test (Required): TestNG annotation to mark the method as a test.
    • @QaseTitle (Required): Sets the title for the new test case in Qase.io.
    • @Automation (Optional): Sets the automation state: NOT_AUTOMATED, TO_BE_AUTOMATED, or AUTOMATED.
    • @Status (Optional): Sets the case status: ACTUAL, DRAFT (default), or DEPRECATED.
    • @Suite (Optional): Sets the package/directory in Qase.io where the case is stored. If omitted, it is stored in the root.

    Syncing New Cases

    • Locally: Run the new test classes with the -DQASEIO_API_TOKEN configured.
    • CI/CD: Commit and push changes to trigger the E2E Manual suite on your branch.

    Note: New test cases are stored in the project's repository directory; you must manually edit expected results in the Qase.io UI.

  9. Run Kafka UI using Docker Compose

    master

    You can run the full Kafka UI stack, including your Kafka clusters, using Docker Compose. This command must be executed from the root directory of the repository.

    docker-compose -f ./documentation/compose/kafka-ui.yaml up

    Note: Ensure that none of your .env* files contain the DEV_PROXY variable when running via Docker to avoid configuration conflicts.

  10. Persistent installation with Docker Compose

    master

    For a permanent installation where configurations are preserved, use Docker Compose and mount a local configuration file to the container. This example uses DYNAMIC_CONFIG_ENABLED: 'true' to allow runtime configuration changes.

    services:
      kafka-ui:
        container_name: kafka-ui
        image: provectuslabs/kafka-ui:latest
        ports:
          - 8080:8080
        environment:
          DYNAMIC_CONFIG_ENABLED: 'true'
        volumes:
          - ~/kui/config.yml:/etc/kafkaui/dynamic_config.yaml
  11. Set up Qase.io integration for E2E checks

    master

    To integrate the E2E testing framework with Qase.io TMS, you must provide an API token via a VM option in your run configuration. This allows the qase-api and qase-testng libraries to communicate with your Qase project.

    Add the following VM option to your local run configuration, replacing %s with your actual Qase API token:

    -DQASEIO_API_TOKEN='%s'