This page shows how to configure Google Kubernetes Engine (GKE) clusters with GKE Dataplane V2 observability, starting in GKE versions 1.28 or later. For more information on the benefits and requirements of GKE Dataplane V2 observability, see About GKE Dataplane V2 observability.
Before you begin
Before you start, make sure you have performed the following tasks:
- Enable the Google Kubernetes Engine API. Enable Google Kubernetes Engine API
- If you want to use the Google Cloud CLI for this task,
install and then
initialize the
gcloud CLI. If you previously installed the gcloud CLI, get the latest
version by running
gcloud components update
.
Configure GKE Dataplane V2 metrics
To collect metrics, you must configure GKE Dataplane V2 metrics. You can configure GKE Dataplane V2 metrics when you create a cluster or update a cluster running with GKE Dataplane V2. You can enable or disable GKE Dataplane V2 metrics using the gcloud CLI.
We recommend enabling GKE Dataplane V2 metrics and Google Cloud Managed Service for Prometheus on your GKE cluster. Once both are enabled, GKE Dataplane V2 metrics are sent to Google Cloud Managed Service for Prometheus.
Create an Autopilot cluster with GKE Dataplane V2 metrics enabled
When you create new GKE Autopilot clusters, GKE enables GKE Dataplane V2 metrics by default on the cluster without requiring a specific flag.
To use the GKE Autopilot cluster GKE Dataplane V2 metrics
with Google Cloud Managed Service for Prometheus, configure the ClusterPodMonitoring
resource to scrape the metrics and send them to Google Cloud Managed Service for Prometheus.
Create a
ClusterPodMonitoring
manifest:Apply the
ClusterPodMonitoring
manifest:kubectl apply -f ClusterPodMonitoring.yaml
Create a Standard cluster with GKE Dataplane V2 metrics enabled
To enable GKE Dataplane V2 metrics, create a cluster with the
--enable-dataplane-v2-metrics
flag:
gcloud container clusters create CLUSTER_NAME \
--enable-dataplane-v2 \
--enable-ip-alias \
--enable-managed-prometheus \
--enable-dataplane-v2-metrics
Replace the following:
CLUSTER_NAME
: the name of your cluster.
The --enable-managed-prometheus
flag instructs GKE to use the
metrics with Google Cloud Managed Service for Prometheus.
Enable GKE Dataplane V2 metrics on an existing cluster
To enable GKE Dataplane V2 metrics on an existing cluster, run the following command:
gcloud container clusters update CLUSTER_NAME \
--enable-dataplane-v2-metrics
Replace CLUSTER_NAME
with the name of your cluster.
Disable GKE Dataplane V2 metrics
To disable GKE Dataplane V2 metrics:
gcloud container clusters update CLUSTER_NAME \
--disable-dataplane-v2-metrics
Replace CLUSTER_NAME
with the name of your cluster.
Configure GKE Dataplane V2 observability tools
You can use a private endpoint to access the GKE Dataplane V2 observability troubleshooting tools. To enable GKE Dataplane V2 observability tools, you must have a cluster configured with GKE Dataplane V2. You can enable GKE Dataplane V2 observability tools on a new cluster or an existing cluster.
Create an Autopilot cluster with observability enabled
To create a GKE Autopilot cluster with GKE Dataplane V2 observability enabled:
gcloud container clusters create-auto CLUSTER_NAME \
--enable-dataplane-v2-flow-observability
Replace CLUSTER_NAME
with the name of your cluster.
Create a Standard cluster with observability enabled
To create a GKE Standard cluster with GKE Dataplane V2 observability enabled:
gcloud container clusters create CLUSTER_NAME \
--enable-dataplane-v2 \
--enable-ip-alias \
--enable-dataplane-v2-flow-observability
Replace CLUSTER_NAME
with the name of your cluster.
Enable GKE Dataplane V2 observability tools on an existing cluster
To enable GKE Dataplane V2 observability on an existing cluster, run the following command:
gcloud container clusters update CLUSTER_NAME \
--enable-dataplane-v2-flow-observability
Replace CLUSTER_NAME
with the name of your cluster.
Disable GKE Dataplane V2 observability tools
To disable GKE Dataplane V2 observability tools on an existing cluster, run the following command:
gcloud container clusters update CLUSTER_NAME \
--disable-dataplane-v2-flow-observability
Replace CLUSTER_NAME
with the name of your cluster.
How to use Hubble CLI
Use the Hubble CLI tool on the cluster after you enable the GKE Dataplane V2 observability feature.
Define alias for
hubble-cli
binary:alias hubble="kubectl exec -it -n gke-managed-dpv2-observability deployment/hubble-relay -c hubble-cli -- hubble"
To check the Hubble status, with the GKE Dataplane V2 observability feature enabled, use the Hubble CLI in all Autopilot clusters:
hubble status
To view current traffic, use the Hubble CLI as follows:
hubble observe
How to deploy the Hubble UI binary distribution
After GKE Dataplane V2 observability is enabled, you can deploy the open source Hubble UI.
Enable observability in your GKE cluster:
Create a GKE cluster with observability enabled:
gcloud container clusters create-auto hubble-rc-auto \ --location COMPUTE_LOCATION \ --cluster-version VERSION \ --enable-dataplane-v2-flow-observability
Replace the following:
VERSION
: the version of your cluster.COMPUTE_LOCATION
: the Compute Engine location for the cluster.
Alternatively, enable observability in an existing cluster:
gcloud container clusters update CLUSTER_NAME \ --location COMPUTE_LOCATION \ --enable-dataplane-v2-flow-observability
Replace the following:
CLUSTER_NAME
: the name of your cluster.COMPUTE_LOCATION
: the Compute Engine location for the cluster.
Configure
kubectl
to connect to the cluster:gcloud container clusters get-credentials CLUSTER_NAME \ --location COMPUTE_LOCATION
Replace
CLUSTER_NAME
: the name of your cluster.COMPUTE_LOCATION
: the Compute Engine location for the cluster.
Deploy Hubble UI:
Apply the
hubble-ui-128.yaml
manifest:kubectl apply -f hubble-ui-128.yaml
Expose Service with port forwarding:
kubectl -n gke-managed-dpv2-observability port-forward service/hubble-ui 16100:80 --address='0.0.0.0'
Access the Hubble UI in your web browser: