To view a cluster, you can use the Google Cloud console, the Google Cloud CLI, the client library, or the Managed Kafka API. You can't use the open source Apache Kafka API to view a cluster.
Required roles and permissions to view a cluster
To get the permissions that
you need to view a cluster,
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 view a cluster. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
The following permissions are required to view a cluster:
-
List clusters:
managedkafka.clusters.list
-
Get cluster details:
managedkafka.clusters.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.
View a cluster
To view a cluster, follow these steps:
Console
In the Google Cloud console, go to the Clusters page.
The clusters you created in a project are listed.
To view a specific cluster, click a cluster name.
The cluster details page opens. This page has the following tabs:
- Resources: Displays the list of topics and consumer groups associated with the cluster.
- Configurations: Displays the configuration of the cluster, including the list of subnets associated with the cluster.
- Monitoring: Displays the monitoring alerts associated with the cluster.
- Logs: Displays the logs related to clusters from Logs Explorer.
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-kafka clusters describe
command:gcloud managed-kafka clusters describe CLUSTER_ID \ --location=LOCATION
Replace the following:
- CLUSTER_ID: The ID or name of the cluster.
- LOCATION: The location of the cluster.
REST
Before using any of the request data, make the following replacements:
-
PROJECT_ID
: your Google Cloud project ID -
LOCATION
: the location of the cluster -
CLUSTER_ID
: the ID of the cluster
HTTP method and URL:
GET https://managedkafka.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/clusters/CLUSTER_ID
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_ID/locations/LOCATION/clusters/CLUSTER_ID", "createTime": "CREATE_TIME", "updateTime": "UPDATE_TIME", "capacityConfig": { "vcpuCount": "CPU_COUNT", "memoryBytes": "MEMORY" }, "rebalanceConfig": {}, "gcpConfig": { "accessConfig": { "networkConfigs": [ { "subnet": "projects/PROJECT_ID/locations/LOCATION/subnetworks/SUBNET_ID" } ] } }, "state": "ACTIVE", "satisfiesPzi": false, "satisfiesPzs": false, "tlsConfig": { "trustConfig": {} }, "updateOptions": {} }
Go
Before trying this sample, follow the Go setup instructions in Install the client libraries. For more information, see the Managed Service for Apache Kafka Go API reference documentation.
To authenticate to Managed Service for Apache Kafka, set up Application Default Credentials(ADC). For more information, see Set up ADC for a local development environment.
Java
Before trying this sample, follow the Java setup instructions in Install the client libraries. For more information, see the Managed Service for Apache Kafka Java API reference documentation.
To authenticate to Managed Service for Apache Kafka, set up Application Default Credentials. For more information, see Set up ADC for a local development environment.
Python
Before trying this sample, follow the Python setup instructions in Install the client libraries. For more information, see the Managed Service for Apache Kafka Python API reference documentation.
To authenticate to Managed Service for Apache Kafka, set up Application Default Credentials. For more information, see Set up ADC for a local development environment.
View a cluster's subnets
To view the subnets that are connected to your cluster, perform the following steps:
Console
In the Google Cloud console, go to the Clusters page.
Click the name of the cluster.
In the cluster details page, click the Configurations tab. Connected subnets are listed under Subnets.
gcloud
Run the
gcloud managed-kafka clusters describe
command:gcloud managed-kafka clusters describe CLUSTER_ID \ --location=LOCATION \ --format="yaml(gcpConfig.accessConfig.networkConfigs)"
Replace the following:
- CLUSTER_ID: The ID or name of the cluster.
- LOCATION: The location of the cluster.
For more information, see Configure networking for Managed Service for Apache Kafka.
View a cluster's bootstrap address
Kafka clients use the cluster's bootstrap address to establish a connection with the cluster. To get the bootstrap address, perform the following steps:
Console
Go to the Managed Service for Apache Kafka > Clusters page.
Click the name of the cluster.
Select the Configurations tab.
If you are using SASL to authenticate, the bootstrap URL is listed under mTLS bootstrap URL.
If you are using mutual TLS (mTLS) to authenticate, the bootstrap URL is listed under mTLS bootstrap URL.
Click
Copy to copy the value.
gcloud
To get the bootstrap URL, use the
managed-kafka clusters describe
command.
If you are using SASL to authenticate, run the following command:
gcloud managed-kafka clusters describe CLUSTER_ID \
--location=LOCATION \
--format="value(bootstrapAddress)"
If you are using mutual TLS (mTLS) to authenticate, run the following command:
gcloud managed-kafka clusters describe CLUSTER_ID \
--location=LOCATION \
--format="value(bootstrapAddressMTLS)"
Replace the following:
- CLUSTER_ID: The ID or name of the cluster.
- LOCATION: The location of the cluster.
For more information about SASL and mTSL authentication, see Authentication types for Kafka brokers.