第 6 章 在 Grafana 中使用受管集群标签
启用受管集群标签,将其与 Grafana 仪表板搭配使用。当在 hub 集群中启用可观察性时,observability-managed-cluster-label-allowlist
ConfigMap 会在 open-cluster-management-observability
命名空间中创建。ConfigMap 包含由 observabilty-rbac-query-proxy
pod 维护的受管集群标签列表,用于在 ACM - Cluster Overview Grafana 仪表板中填充要过滤的标签名称列表。默认情况下,可观察性会忽略 observability-managed-cluster-label-allowlist
ConfigMap 中的标签子集。
当集群导入到受管集群团队或修改时,observability-rbac-query-proxy
pod 会监视对受管集群标签的任何更改,并自动更新 observability-managed-cluster-label-allowlist
ConfigMap 以反映更改。ConfigMap 仅包含唯一的标签名称,这些名称包含在 ignore_labels
或 labels
列表中。您的 observability-managed-cluster-label-allowlist
ConfigMap 可能类似以下 YAML 文件:
data: managed_cluster.yaml: | ignore_labels: 1 - clusterID - cluster.open-cluster-management.io/clusterset - feature.open-cluster-management.io/addon-application-manager - feature.open-cluster-management.io/addon-cert-policy-controller - feature.open-cluster-management.io/addon-cluster-proxy - feature.open-cluster-management.io/addon-config-policy-controller - feature.open-cluster-management.io/addon-governance-policy-framework - feature.open-cluster-management.io/addon-iam-policy-controller - feature.open-cluster-management.io/addon-observability-controller - feature.open-cluster-management.io/addon-search-collector - feature.open-cluster-management.io/addon-work-manager - installer.name - installer.namespace - local-cluster - name labels: 2 - cloud - vendor
+ <1> any label is the ConfigMap 的 ignore_labels
keylist 中列出的标签已从 ACM - Clusters Overview Grafana 仪表板的下拉过滤器中删除。<2> 启用的标签会在 ACM - Clusters Overview Grafana 仪表板的下拉过滤器中显示。值来自 acm_managed_cluster_labels
指标,具体取决于所选 label
键值。
继续了解如何在 Grafana 中使用受管集群标签:
6.1. 添加受管集群标签
当您向 observability-managed-cluster-label-allowlist
ConfigMap 中添加受管集群标签时,标签将作为 Grafana 中的过滤器选项提供。为 hub 集群或与受管集群团队关联的受管集群对象添加唯一标签。例如,如果您将标签 department=finance
添加到受管集群,则 ConfigMap 会被更新,并可能类似以下更改:
data: managed_cluster.yaml: | ignore_labels: - clusterID - cluster.open-cluster-management.io/clusterset - feature.open-cluster-management.io/addon-application-manager - feature.open-cluster-management.io/addon-cert-policy-controller - feature.open-cluster-management.io/addon-cluster-proxy - feature.open-cluster-management.io/addon-config-policy-controller - feature.open-cluster-management.io/addon-governance-policy-framework - feature.open-cluster-management.io/addon-iam-policy-controller - feature.open-cluster-management.io/addon-observability-controller - feature.open-cluster-management.io/addon-search-collector - feature.open-cluster-management.io/addon-work-manager - installer.name - installer.namespace - local-cluster - name labels: - cloud - department - vendor