- 使用 --custom-resource-state-config https://github.com/kubernetes/kube-state-metrics/blob/main/docs/customresourcestate-metrics.md 抓取 K8S CRD 指標.
- 使用 --metric-labels-allowlist 抓取 kube pod level labels.
kubectl apply -f secret-tap-crd-overlay.yml -n tanzu-packages
kubectl annotate PackageInstall prometheus ext.packaging.carvel.dev/ytt-paths-from-secret-name.0=tap-crd-overlay -n tanzu-packages
kubectl get app prometheus -n tanzu-packages
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: prometheus-kube-state-metrics-read-tap
subjects:
- kind: ServiceAccount
namespace: tanzu-system-monitoring
name: prometheus-kube-state-metrics
roleRef:
kind: ClusterRole
name: k8s-reader
apiGroup: rbac.authorization.k8s.io
kubectl auth can-i list workload --as=system:serviceaccount:tanzu-system-monitoring:prometheus-kube-state-metrics
kube_carto_run_v1alpha1_Workload_info