Set up GKE Dataplane V2 observability


This page shows how to configure Google Kubernetes Engine (GKE) clusters with GKE Dataplane V2 observability, starting in GKE versions 1.26.4-gke.500 or later or 1.27.1-gke.400 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 PodMonitoring resource to scrape the metrics and send them to Google Cloud Managed Service for Prometheus

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-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 \
    --dataplane-v2-observability-mode=INTERNAL_VPC_LB

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 \
    --dataplane-v2-observability-mode=INTERNAL_VPC_LB

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 \
    --dataplane-v2-observability-mode=INTERNAL_VPC_LB

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 \
    --dataplane-v2-observability-mode=DISABLED

Replace CLUSTER_NAME with the name of your cluster.

How to configure the Hubble CLI binary distribution

During Preview, you can deploy the Hubble CLI as a dedicated CLI tool to inspect and troubleshoot your Kubernetes workloads running on GKE Dataplane V2 clusters.

To set up the Hubble CLI binary distribution, ensure that you have private access to your GKE cluster, for instance, from a virtual machine (VM) within the same VPC.

Use the Hubble CLI tool on the cluster after you enable the GKE Dataplane V2 observability feature.

GKE Autopilot

GKE 1.28 or later

  1. Define alias for hubble-cli binary:

    alias hubble="kubectl exec -it -n gke-managed-dpv2-observability deployment/hubble-relay -c hubble-cli -- hubble"
    
  2. To check the Hubble status, with the GKE Dataplane V2 observability feature enabled, use the Hubble CLI in all Standard clusters:

    hubble status
    
  3. To view current traffic, use the Hubble CLI as follows:

    hubble observe
    

GKE 1.27 or earlier

In GKE clusters, you cannot use Hubble CLI from the kube-system namespace because you won't have access to it. To run the Hubble image and CLI commands, you must acquire certificates, download the open source Hubble CLI binary, and run commands from the binary deployed by Docker. We recommend that you run Hubble CLI commands from a VM that can privately reach the cluster's Hubble Relay Service and has gcloud CLI, kubectl, and Docker installed.

To configure the CLI binary distribution:

  1. Download required certificates:

    mkdir -p relay-certs
    kubectl -n kube-system get secret hubble-relay-client-certs \
        -o "jsonpath={.data['ca\.crt']}" | base64 -d >relay-certs/ca.crt
    kubectl -n kube-system get secret hubble-relay-client-certs \
        -o "jsonpath={.data['tls\.crt']}" | base64 -d >relay-certs/client.crt
    kubectl -n kube-system get secret hubble-relay-client-certs \
        -o "jsonpath={.data['tls\.key']}" | base64 -d >relay-certs/client.key
    
  2. Download the Hubble CLI image:

    docker pull gcr.io/gke-release/cilium/hubble-cli@sha256:53e58ae42b2299949e8c2a8fedda0c142b72b7111e6f316d88788d4227ed4733
    
  3. Find Hubble Relay Service IP address:

    export RELAY_SERVICE_IP=`kubectl -n kube-system get svc hubble-ilb-svc \
        -o "jsonpath={.status.loadBalancer.ingress[0].ip}"`
    
  4. To print the Hubble Server current status, run the Hubble CLI tool and hubble status command in the Docker container:

    docker run -it --rm \
        -v $PWD/relay-certs:/relay-certs:ro \
        -e HUBBLE_SERVER=tls://${RELAY_SERVICE_IP}:443 \
        -e HUBBLE_TLS_CLIENT_CERT_FILE=/relay-certs/client.crt \
        -e HUBBLE_TLS_CLIENT_KEY_FILE=/relay-certs/client.key \
        -e HUBBLE_TLS_CA_CERT_FILES=/relay-certs/ca.crt \
        -e HUBBLE_TLS_SERVER_NAME=relay.kube-system.svc.cluster.local \
        gcr.io/gke-release/cilium/hubble-cli@sha256:53e58ae42b2299949e8c2a8fedda0c142b72b7111e6f316d88788d4227ed4733 \
        status
    
  5. To print the current traffic metadata, run the Hubble CLI tool and hubble observe command in the Docker container:

    docker run -it --rm \
        -v $PWD/relay-certs:/relay-certs:ro \
        -e HUBBLE_SERVER=tls://${RELAY_SERVICE_IP}:443 \
        -e HUBBLE_TLS_CLIENT_CERT_FILE=/relay-certs/client.crt \
        -e HUBBLE_TLS_CLIENT_KEY_FILE=/relay-certs/client.key \
        -e HUBBLE_TLS_CA_CERT_FILES=/relay-certs/ca.crt \
        -e HUBBLE_TLS_SERVER_NAME=relay.kube-system.svc.cluster.local \
        gcr.io/gke-release/cilium/hubble-cli@sha256:53e58ae42b2299949e8c2a8fedda0c142b72b7111e6f316d88788d4227ed4733 \
        observe
    

GKE Standard

GKE 1.28 or later

  1. Define alias for hubble-cli binary:

    alias hubble="kubectl exec -it -n gke-managed-dpv2-observability deployment/hubble-relay -c hubble-cli -- hubble"
    
  2. To check the Hubble status, with the GKE Dataplane V2 observability feature enabled, use the Hubble CLI in all Standard clusters:

    hubble status
    
  3. To view current traffic, use the Hubble CLI as follows:

    hubble observe
    

GKE 1.27 or earlier

  1. Define alias for hubble-cli binary:

    alias hubble="kubectl exec -it -n kube-system deployment/hubble-relay -c hubble-cli -- hubble"
    
  2. To check the Hubble status, with the GKE Dataplane V2 observability feature enabled, use the Hubble CLI in all Standard clusters:

    hubble status
    
  3. 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.

GKE Autopilot

GKE 1.28 or later

  1. Enable observability in your Autopilot cluster:

    1. Create an Autopilot cluster with observability enabled:

      gcloud container clusters create-auto hubble-rc-auto \
          --location COMPUTE_LOCATION \
          --cluster-version VERSION \
          --dataplane-v2-observability-mode=INTERNAL_VPC_LB
      

      Replace the following:

    2. Alternatively, enable observability in an existing cluster:

      gcloud container clusters update CLUSTER_NAME \
          --location COMPUTE_LOCATION \
          --dataplane-v2-observability-mode=INTERNAL_VPC_LB
      

      Replace the following:

  2. Configure kubectl to connect to the cluster:

    gcloud container clusters get-credentials CLUSTER_NAME \
        --location COMPUTE_LOCATION
    

    Replace

  3. Deploy Hubble UI:

  1. Apply the hubble-ui-auto.yaml manifest:

    kubectl apply -f hubble-ui-auto.yaml
    
  2. Expose Service with port forwarding:

    kubectl -n gke-managed-dpv2-observability port-forward service/hubble-ui 16100:80 --address='0.0.0.0'
    
  3. Access the Hubble UI in your web browser:

    http://localhost:16100/

GKE 1.27 or earlier

  1. Enable observability in your Autopilot cluster:

    1. Create an Autopilot cluster with observability enabled:

      gcloud container clusters create-auto hubble-rc-auto \
          --location COMPUTE_LOCATION \
          --cluster-version VERSION \
          --dataplane-v2-observability-mode=INTERNAL_VPC_LB
      

      Replace the following:

    2. Alternatively, enable observability in an existing cluster:

      gcloud container clusters update CLUSTER_NAME \
          --location COMPUTE_LOCATION \
          --dataplane-v2-observability-mode=INTERNAL_VPC_LB
      

      Replace the following:

  2. Configure kubectl to connect to the cluster:

    gcloud container clusters get-credentials CLUSTER_NAME \
        --location COMPUTE_LOCATION
    

    Replace the following:

  3. Create new namespace for Hubble UI deployment (because it cannot reside in the kube-system namespace):

    kubectl create namespace hubble-ui
    
  4. Copy client TLS certs from the kube-system namespace:

    kubectl -n kube-system get secrets hubble-relay-client-certs -oyaml  | \
        yq eval 'del(.metadata.namespace, .metadata.annotations, .metadata.uid, .metadata.creationTimestamp, .metadata.resourceVersion)' | \
        kubectl -n hubble-ui create -f -
    
    kubectl -n kube-system get secrets hubble-relay-client-certs -oyaml  | \
        yq eval 'del(.metadata.namespace, .metadata.annotations, .metadata.uid, .metadata.creationTimestamp, .metadata.resourceVersion)' | \
        kubectl -n hubble-ui create -f -
    
  5. Deploy Hubble UI:

  1. Apply the hubble-ui-auto.yaml manifest:

    kubectl apply -f hubble-ui-auto.yaml
    
  2. Expose the Hubble UI service with port forwarding:

    kubectl -n hubble-ui port-forward service/hubble-ui 16100:80 --address='0.0.0.0'
    
  3. Access the Hubble UI in your web browser:

    http://localhost:16100/

GKE Standard

GKE 1.28 or later

  1. Enable GKE Dataplane V2 observability in your Standard cluster:

    1. Create a Standard cluster with GKE Dataplane V2 observability enabled:

      gcloud container clusters create CLUSTER_NAME \
          --enable-dataplane-v2 \
          --cluster-version VERSION \
          --dataplane-v2-observability-mode=INTERNAL_VPC_LB
      

      Replace the following:

      • CLUSTER_NAME: the name of your cluster.
      • VERSION: the version of your cluster.
    2. Alternatively, enable GKE Dataplane V2 observability in an existing cluster:

      gcloud container clusters update CLUSTER_NAME \
          --location=COMPUTE_LOCATION \
          --dataplane-v2-observability-mode=INTERNAL_VPC_LB
      

      Replace the following:

  2. Configure kubectl to connect to the cluster:

    gcloud container clusters get-credentials CLUSTER_NAME \
        --location COMPUTE_LOCATION
    

    Replace

  3. Deploy Hubble UI:

  1. Apply the hubble-ui-std.yaml manifest:

    kubectl apply -f hubble-ui-std.yaml
    
  2. Expose Service with port forwarding:

    kubectl -n gke-managed-dpv2-observability port-forward service/hubble-ui 16100:80 --address='0.0.0.0'
    
  3. Access the Hubble UI in your web browser:

    http://localhost:16100/

GKE 1.27 or earlier

  1. Enable GKE Dataplane V2 observability in your Standard cluster:

    1. Create a Standard cluster with GKE Dataplane V2 observability enabled:

      gcloud container clusters create CLUSTER_NAME \
          --enable-dataplane-v2 \
          --cluster-version VERSION \
          --dataplane-v2-observability-mode=INTERNAL_VPC_LB
      

      Replace the following:

      • CLUSTER_NAME: the name of your cluster.
      • VERSION: the version of your cluster.
    2. Alternatively, enable GKE Dataplane V2 observability in an existing cluster:

      gcloud container clusters update CLUSTER_NAME \
          --location=COMPUTE_LOCATION \
          --dataplane-v2-observability-mode=INTERNAL_VPC_LB
      

      Replace the following:

      • CLUSTER_NAME: the name of your cluster.
      • COMPUTE_LOCATION: the Compute Engine location for the cluster control plane.
  2. Configure kubectl to connect to the cluster:

    gcloud container clusters get-credentials CLUSTER_NAME \
        --zone COMPUTE_LOCATION
    

    Replace

    • CLUSTER_NAME: the name of your cluster.
    • COMPUTE_LOCATION: the Compute Engine location for the cluster control plane.
  3. Deploy Hubble UI:

  1. Apply the hubble-ui-std.yaml manifest:

    kubectl apply -f hubble-ui-std.yaml
    
  2. Expose service with port forwarding:

    kubectl -n kube-system port-forward service/hubble-ui 16100:80 --address='0.0.0.0'
    
  3. Access the Hubble UI in your web browser:

    http://localhost:16100/

What's next