To list your consumer groups in a cluster, you can use the Google Cloud console, the Google Cloud CLI, the client library, the Managed Kafka API, or the open source Apache Kafka APIs.
Required roles and permissions to list your consumer groups
To get the permissions that you need to list your consumer groups,
ask your administrator to grant you the
Managed Kafka Viewer (roles/managedkafka.viewer
) IAM role on your project.
For more information about granting roles, see Manage access to projects, folders, and organizations.
This predefined role contains the permissions required to list your consumer groups. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
The following permissions are required to list your consumer groups:
-
List consumer groups:
managedkafka.consumerGroups.list
-
Get consumer group details:
managedkafka.consumerGroups.get
You might also be able to get these permissions with custom roles or other predefined roles.
For more information about the Managed Kafka Viewer role, see Managed Service for Apache Kafka predefined roles.
List your consumer groups
To list all your consumer groups for a specific cluster, follow these steps:
Console
In the Google Cloud console, go to the Cluster page.
- Click the cluster for which you want to see the consumer groups.
The cluster details page is displayed. In the cluster details page, under the Resources tab, the consumer groups are listed.
gcloud
-
In the Google Cloud console, activate Cloud Shell.
At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.
Run the
gcloud managed-service-for-apache-kafka consumer-groups list
command:gcloud managed-kafka consumer-groups list CLUSTER_ID \ --location=LOCATION \ --limit=LIMIT
This command lists all Managed Service for Apache Kafka consumer groups within a specified cluster and location.
Replace the following:
-
CLUSTER_ID: The ID or name of the cluster.
-
LOCATION: The location of the cluster.
-
LIMIT: The maximum number of consumer groups to list.
-