Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2: metricLabelsAllowlist for kube-state-metrics not working in k8s-monitoring-helm #1040

Open
cxk314 opened this issue Dec 27, 2024 · 0 comments

Comments

@cxk314
Copy link

cxk314 commented Dec 27, 2024

Hi,
I am trying to get all kube-state-metrics but specifying metricLabelsAllowlist: [pods=[*], namespaces=[*]] doesn't seem to be doing anything. I was able to partially fix it by using metricsTuning and listing metrics which I was able to identify missing but that is not robust solution as I don't know what else is missing. For example kube_namespace_labels only starter to show up once I added it in metricsTuning. I would like to get all kube-state-metrics scraped but not sure how to configure it. Here is the config I am trying:

cluster:
  name: sb-cluster

destinations:
  - name: otlp
    type: otlp
    url: https://np-grpc.np-shared.com
    processors:
      batch:
        size: 2000
        maxSize: 2000
      k8sattributes:
        # -- Kubernetes metadata to extract and add to the attributes of the received telemetry data.
        # @section -- Processors: K8s Attributes
        metadata:
          - container.name
          - deployment.environment
          - k8s.cluster.name
          - k8s.container.name
          - k8s.replicaset.name
          - k8s.namespace.name
          - k8s.pod.name
          - k8s.deployment.name
          - service.name
          - service.namespace
          - k8s.statefulset.name
          - service.instance.id
          - k8s.daemonset.name
          - k8s.cronjob.name
          - k8s.job.name
          - k8s.node.name
          - k8s.pod.uid
          - k8s.pod.start_time
      attributes:
        actions:
          - key: TENANT_ID
            action: upsert
            value: sb-cluster
      transform:
        metrics:
          resource:
            - set(attributes["CUSTOM_TENANT_ID"], "Test_Custom_Label") where attributes["k8s.namespace.name"] == "dapr-system"
        logs:
            log:
              - set(resource.attributes["TENANT_ID"], "sb-cluster")
        traces:
          resource:
            - set(attributes["CUSTOM_TENANT_ID"], "Test_Custom_Label") where attributes["k8s.namespace.name"] == "dapr-system"
    metrics:
      # -- Whether to send metrics to the OTLP destination.
      # @section -- Telemetry
      enabled: true
    logs:
      # -- Whether to send logs to the OTLP destination.
      # @section -- Telemetry
      enabled: true
    tls:
      # -- Disables validation of the server certificate.
      # @section -- TLS
      insecureSkipVerify: true

clusterMetrics:
  enabled: true
  kube-state-metrics:
    podAnnotations: {kubernetes.azure.com/set-kube-service-host-fqdn: "true"}
    metricsTuning:
      useDefaultAllowList: false
      includeMetrics:
      - kube_namespace_labels
      - kube_service_created
      - kube_deployment_created
      - kube_configmap_created
      - kube_ingress_created
      - kube_secret_created
      - kube_persistentvolumeclaim_info
      - kube_persistentvolume_status_phase
      - kube_pod_container_status_ready
      - kube_pod_container_status_waiting
      - kube_pod_container_status_terminated
    metricLabelsAllowlist:
      - pods=[*]
      - namespaces=[*]

clusterEvents:
  enabled: true

podLogs:
  enabled: true

nodeLogs:
  enabled: true

windows-exporter:
  deploy: false

selfReporting:
  enabled: false

# -- Application Observability.
# Requires destinations that supports metrics, logs, and traces.
# To see the valid options, please see the [Application Observability feature documentation](https://github.com/grafana/k8s-monitoring-helm/tree/main/charts/feature-application-observability).
# @default -- Disabled
# @section -- Features - Application Observability
applicationObservability:
  # -- Enable gathering Kubernetes Pod logs.
  # @section -- Features - Application Observability
  enabled: true
  receivers:
    otlp:
      grpc:
        enabled: true

alloy-metrics:
  enabled: true
  liveDebugging:
    enabled: true
  alloy:
    enableReporting: false
    stabilityLevel: experimental
  controller:
    podAnnotations: {kubernetes.azure.com/set-kube-service-host-fqdn: "true"}

alloy-singleton:
  enabled: true
  liveDebugging:
    enabled: true
  controller:
    podAnnotations: {kubernetes.azure.com/set-kube-service-host-fqdn: "true"}
  alloy:
    enableReporting: false
    stabilityLevel: experimental

alloy-logs:
  enabled: true
  liveDebugging:
    enabled: true
  alloy:
    enableReporting: false
    stabilityLevel: experimental
  controller:
    podAnnotations: {kubernetes.azure.com/set-kube-service-host-fqdn: "true"}

# An Alloy instance for opening receivers to collect application data.
alloy-receiver:
  # -- Deploy the Alloy instance for opening receivers to collect application data.
  # @section -- Collectors - Alloy Receiver
  enabled: true
  liveDebugging:
    enabled: true
  controller:
    podAnnotations: {kubernetes.azure.com/set-kube-service-host-fqdn: "true"}
  extraConfig: |-
      faro.receiver "integrations_app_agent_receiver" {
        server {
          listen_address           = "0.0.0.0"
          listen_port              = 8027
          cors_allowed_origins     = ["*"]
          max_allowed_payload_size = "10MiB"

          rate_limiting {
            rate = 100
          }
        }

        output {
          logs   = [otelcol.receiver.loki.otlp.receiver]
          traces = [otelcol.processor.transform.otlp.input]
        }
      }
  alloy:
    enableReporting: false
    stabilityLevel: experimental
    extraPorts:
      - name: otlp-grpc
        port: 4317
        targetPort: 4317
        protocol: TCP
      - name: faro
        port: 8027
        targetPort: 8027
        protocol: TCP
@cxk314 cxk314 changed the title metricLabelsAllowlist for kube-state-metrics not working in k8s-monitoring-helm v2 v2: metricLabelsAllowlist for kube-state-metrics not working in k8s-monitoring-helm Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant