此内容没有您所选择的语言版本。

Chapter 2. Deploying 3scale for the Kafka Bridge


To integrate 3scale with Kafka Bridge, you need to configure the deployment to discover the Kafka Bridge API.

In this scenario, Streams for Apache Kafka, Kafka, Kafka Bridge, and 3scale API Management run in the same OpenShift cluster. 3scale APIcast acts as an NGINX-based API gateway, allowing HTTP clients to connect to the Kafka Bridge API service.

This procedure uses the following 3scale custom resources, managed through the 3scale operator:

  • OpenAPI custom resource to import the Kafka Bridge OpenAPI specification
  • Product custom resource to import the Kafka Bridge routing policies and set up an application plan and application.
  • ProxyConfigPromote custom resource to promote the product’s APIcast configuration.

For details on creating and managing these resources, see the operator instructions in the Red Hat 3scale documentation.

Note

If 3scale is already deployed in the same cluster as Kafka Bridge, skip the deployment steps and use the existing deployment.

Prerequisites

For 3scale deployment:

Procedure

  1. Set up 3scale API Management as outlined in the Red Hat 3scale documentation.

    1. Install 3scale API Manager and APIcast using the 3scale operators.

      Before deploying API Manager, update the wildcardDomain property of the APIManager custom resource to match your OpenShift cluster’s domain.

      The domain is used in the URL to access the 3scale Admin Portal (http[s]://<authentication_token>@3scale-admin.<cluster_domain>).

    2. Verify 3scale deployment by checking the status of the APIManager custom resource.
  2. Authorize 3scale API Manager to discover Kafka Bridge:

    oc adm policy add-cluster-role-to-user view system:serviceaccount:<my_bridge_namespace>:amp
    Copy to Clipboard Toggle word wrap

    This command grants the API Manager (amp) read access (view) to Kafka Bridge resources in the specified namespace (<my_bridge_namespace>).

  3. Ensure the Cluster Operator deployment has the required labels and annotations for 3scale discovery:

    #...
    env:
    - name: STRIMZI_CUSTOM_KAFKA_BRIDGE_SERVICE_LABELS
        value: |
        discovery.3scale.net=true
    - name: STRIMZI_CUSTOM_KAFKA_BRIDGE_SERVICE_ANNOTATIONS
        value: |
        discovery.3scale.net/scheme=http
        discovery.3scale.net/port=8080
        discovery.3scale.net/path=/
        discovery.3scale.net/description-path=/openapi/v3
    #...
    Copy to Clipboard Toggle word wrap

    The /openapi endpoint will represent OpenAPI v3 once support for OpenAPI v2 is deprecated in the Kafka Bridge. At that time, the /openapi/v3 endpoint will be removed.

    If necessary, update these properties through the OpenShift console or redeploy the Cluster Operator and Kafka Bridge.

  4. From the 3scale Admin Portal, import the Kafka Bridge API service from OpenShift as outlined in the Red Hat 3scale documentation.
  5. Add the servers property to the OpenAPI specification (JSON file) to reference the base Kafka Bridge service URL:

    Example reference to the Kafka Bridge service URL

    {
        "openapi": "3.0.0",
        "info": {
          "title": "Kafka Bridge API Reference",
          "description": "The Kafka Bridge provides a REST API
            for integrating HTTP based client applications with
            a Kafka cluster. You can use the API to create and
            manage consumers and send and receive records over
            HTTP rather than the native Kafka protocol. ",
            "version": "0.1.0"
        },
        "servers": [
          {
            "url": "https://my-bridge-bridge-service.my-project.svc.cluster.local:8080"
          }
        ],
        "paths": {
    Copy to Clipboard Toggle word wrap

    Make sure the servers URL includes the following:

    • Kafka Bridge name (my-bridge)
    • Project name (my-project)
    • Port for the Kafka Bridge (8080)
  6. Import the Kafka Bridge OpenAPI specification by creating an OpenAPI custom resource.

    When creating the OpenAPI custom resource, the 3scale operator automatically creates a 3scale Product custom resource, which includes a service ID.

  7. Update the Product custom resource by importing the Kafka Bridge routing policies (policies_config.json).
  8. From the 3scale Admin Portal, check that the endpoints and policies for the Kafka Bridge service have loaded.
  9. Update the Product custom resource to set up an application plan and application.

    The application is necessary to obtain a user key for authentication.

  10. (For production) Promote the product’s APIcast configuration by creating a ProxyConfigPromote custom resource.
  11. Verify API access to Kafka Bridge through the APIcast gateway using a consumer creation call and the user key generated for the application.

    For example:

    https//my-project-my-bridge-bridge-service-3scale-apicast-staging.example.com:443/consumers/my-group?user_key=3dfc188650101010ecd7fdc56098ce95
    Copy to Clipboard Toggle word wrap

    If the response payload is returned from Kafka Bridge, the consumer was successfully created.

    {
      "instance_id": "consumer1",
      "base uri": "https//my-project-my-bridge-bridge-service-3scale-apicast-staging.example.com:443/consumers/my-group/instances/consumer1"
    }
    Copy to Clipboard Toggle word wrap

    The base URI is the address that the client will use for subsequent requests.

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat