[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2024-09-15。"],[],[],null,["# Observe your traffic using GKE Dataplane V2 observability\n\n[Autopilot](/kubernetes-engine/docs/concepts/autopilot-overview) [Standard](/kubernetes-engine/docs/concepts/choose-cluster-mode)\n\n*** ** * ** ***\n\nThis page shows you how to observe your traffic using GKE Dataplane V2 observability.\nFor more information on the benefits and requirements of GKE Dataplane V2 observability,\nsee [About GKE Dataplane V2 observability](/kubernetes-engine/docs/concepts/about-dpv2-observability).\nFor information on configuration, see\n[Set up GKE Dataplane V2 observability](/kubernetes-engine/docs/how-to/configure-dpv2-observability).\n\nHow to use GKE Dataplane V2 observability\n-----------------------------------------\n\nStart by enabling GKE Dataplane V2 metrics with Google Cloud Managed Service for Prometheus.\nTo create custom dashboards and set alerts similar to any of the metrics that\nyou've been monitoring, you can use [Google Cloud Observability](/products/operations) tools such\nas [Cloud Monitoring Metrics Explorer](/monitoring/charts/metrics-explorer).\n\nYou can also configure any third-party dashboard or tooling that uses Prometheus,\nincluding Grafana. With your GKE cluster enabled with GKE Dataplane V2\nobservability, you can inspect traffic with GKE Dataplane V2 observability tools.\n\n### Visualize metrics and Service dependencies\n\nYou can visualize Kubernetes traffic metrics and Service Dependencies as follows:\n\n#### View cluster and workload observability metrics\n\nTo view GKE Dataplane V2 metrics for your clusters, perform the following steps\nin the Google Cloud console in the Metrics Explorer:\n\n1. Go to the **Monitoring Metrics Explorer** page.\n\n2. Select the **Metric** under the **Query** as either the\n **Prometheus Target prometheus/pod_flow_egress_flows_count** or\n **prometheus/pod_flow_ingress_flows_count/counter**.\n\n3. (Optional) Choose any selected filters based on **Labels**.\n\n4. (Optional) Save the chart to a custom **Dashboard**.\n\n#### Visualize Service dependencies\n\nUse the Hubble UI to be able to determine the dependencies of the Pod and Services\ndeployed on your cluster at a glance. Visualize the traffic flows including those\nreaching out to external destinations. Filter by namespaces, Kubernetes labels,\nand more.\n\n#### Verify traffic flows\n\nThe Hubble UI can also be used to view live flows happening on your cluster.\nEach live flow shows the source and destination services, destination port,\nPolicy verdicts and timestamps.\n\n### Inspect traffic with GKE Dataplane V2 observability tools\n\nYou can capture and analyze network traffic using GKE Dataplane V2 observability\ntools, accessed using a private endpoint. The endpoint is exposed on an internal\nIP address, which you can access from within the Kubernetes cluster and the\nVPC within which the cluster resides.\n\nTo inspect network traffic metadata, use the following commands:\n\n#### Use the built-in hubble-cli plugin to inspect network traffic\n\n alias hubble=\"kubectl exec -it deployment/hubble-relay -c hubble-cli -n gke-managed-dpv2-observability -- hubble\"\n hubble observe\n\nThis command inspects network traffic for the cluster.\n\n#### Use the built-in hubble-cli plugin to inspect network traffic in follow mode\n\n alias hubble=\"kubectl exec -it deployment/hubble-relay -c hubble-cli -n gke-managed-dpv2-observability -- hubble\"\n hubble observe -f\n\nThis command inspects network traffic metadata in following mode for the cluster:\n\n#### Use the built-in hubble-cli plugin to inspect network traffic in single namespace\n\n alias hubble=\"kubectl exec -it deployment/hubble-relay -c hubble-cli -n gke-managed-dpv2-observability -- hubble\"\n hubble observe -n default\n\nThis command uses the built-in hubble-cli plugin to inspect network traffic for\nthe default namespace in the cluster.\n\nTo enable `Hubble Relay` use the `--enable-dataplane-v2-flow-observability` flag.\n\n### Analyze traffic flows\n\nUse the Hubble CLI to observe live traffic flow dumps with the ability to filter\nwith Kubernetes namespaces and more.\n\nWhat's next\n-----------\n\n- [Configure Metrics Explorer to view GKE Dataplane V2 metrics](/monitoring/charts/metrics-selector)"]]