Enabling API discovery on Kubernetes

You can optionally configure API discovery in IBM® API Connect on a Kubernetes, OpenShift, or IBM Cloud Pak for Integration deployment by enabling the API discovery service.

About this task

The API discovery service is an optional add-on to API Connect that can be used to discover and add APIs to your API development process.

Note:
  • These instructions apply only to Kubernetes, OpenShift, and IBM Cloud Pak for Integration installations.
  • APIs cannot be discovered and added to your deployment until the API discovery service is enabled.
  • If you're using a two data center disaster recovery (2DCDR) deployment, the API discovery service must be enabled on both the active and warm-standby centers. Enable the service on the warm-standby data center first, and then the active center.
  • If you enable the API discovery service, the backups that you take can be restored only onto a management subsystem that also has the API discovery service enabled.
To enable or disable the API discovery service, you must configure the Management subsystem custom resource (CR) file. See the following instructions:

After the API discovery service is enabled, API discovery resources can be created. For more information, see API discovery.

Procedure

  • Enabling the API discovery service as part of a new deployment

    Edit the CR file for the Management subsystem and add the settings for the API discovery service.

    1. Edit the ManagementCluster CR and add the following definition for the API discovery service. Append the API discovery definition to the end of the spec: section, making sure to adhere to the spacing used in the file.
      spec:
        ...
        discovery:
          enabled: true
          proxyCollectorEnabled: true
    2. Apply the updated CR by running the following command as part of the standard Management subsystem installation (see Installing the management subsystem for details):
      kubectl apply -f management_cr.yaml -n <management_namespace>
      Where management_namespace is the name of the target installation namespace in the Kubernetes cluster.

      The API discovery service will be enabled with the Management subsystem.

    3. You can monitor your Kubernetes deployments by running the following command:
      kubectl get deployments -n <management_namespace>
      The installation is complete when the api-discovery pods are shown in the list of returned values, and the ManagementCluster has completed with a READY status of True, and the SUMMARY reports that the services are online, for example 1/1.
  • Enabling the API discovery service as part of an existing deployment

    Edit the deployed CR for the Management subsystem and add the settings for the API discovery service.

    1. Retrieve the name of the deployed CR for the Management subsystem by running the following command:
      kubectl get managementcluster -n <management_namespace>
      Where management_namespace is the name of the target installation namespace in the Kubernetes cluster.
    2. Edit the deployed CR by running the following command:
      kubectl edit managementcluster <management-cr-name> -n <management_namespace>
      Where:
      • management-cr-name is the name of the deployed CR for the Management subsystem.
      • management_namespace is the name of the target installation namespace in the Kubernetes cluster.
    3. In the editor, append the API discovery definition to the end of the spec: section, making sure to adhere to the spacing used in the file.
      spec:
        ...
        discovery:
          enabled: true
          proxyCollectorEnabled: true
    4. Save the update.

      The API discovery service is enabled in the Management subsystem.

    5. You can monitor your Kubernetes deployments by running the following command:
      kubectl get deployments -n <management_namespace>
      The installation is complete when the api-discovery pods are shown in the list of returned values, and the ManagementCluster has completed with a READY status of True, and the SUMMARY reports that the services are online, for example 1/1.
  • Disabling the API discovery service

    Edit the deployed CR for the Management subsystem and update the settings for the API discovery service.

    1. Retrieve the name of the deployed CR for the Management subsystem by running the following command:
      kubectl get managementcluster -n <management_namespace>
      Where management_namespace is the name of the target installation namespace in the Kubernetes cluster.
    2. Edit the deployed CR by running the following command:
      kubectl edit managementcluster <management-cr-name> -n <management_namespace>
      Where:
      • management-cr-name is the name of the deployed CR for the Management subsystem.
      • management_namespace is the name of the target installation namespace in the Kubernetes cluster.
    3. In the editor, change the API discovery definition to enabled: false.
      spec:
        ...
        discovery:
          enabled: false
          proxyCollectorEnabled: false
    4. Save the update.

      The API discovery service is disabled in the Management subsystem.

Results

Note that when the API discovery service is enabled, there are a number of new deployments, jobs, and pods in the ManagementCluster namespace. These Kubernetes API discovery resources have names that contain api-discovery. For example:
kubectl get pods -n apic | grep discovery
management-api-discovery-gw-proxy-collector-8d8bdfbdf5lfbj   1/1     Running     0             88m
management-api-discovery-gw-proxy-collector-8d8bdfbdf67qqz   1/1     Running     0             88m
management-api-discovery-gw-proxy-collector-8d8bdfbdfzrhkv   1/1     Running     0             88m
management-api-discovery-service-f7dc497d8-gc7dn             1/1     Running     0             89m
management-api-discovery-service-f7dc497d8-pd877             1/1     Running     0             89m
management-api-discovery-service-f7dc497d8-shzm9             1/1     Running     0             89m
management-api-discovery-ui-5549df59d9-b4fks                 1/1     Running     0             88m
management-api-discovery-ui-5549df59d9-gjqmx                 1/1     Running     0             88m
management-api-discovery-ui-5549df59d9-pjvsx                 1/1     Running     0             88m
management-up-api-discovery-service-data-populate-0-tvxbvs   0/1     Completed   0             90m
management-up-api-discovery-service-schema-0-to-2-mrs8d      0/1     Completed   0             90m