opencost-helm-chart icon indicating copy to clipboard operation
opencost-helm-chart copied to clipboard

Instance/Node label duplicated for Node IP and name

Open MuriloCouceiro opened this issue 2 years ago • 4 comments

Description

I've installed the OpenCost helm chart 1.18.0 with the following values

opencost:
    nodeSelector:
      kubernetes.io/os: linux
    metrics:
      serviceMonitor:
        enabled: true
    exporter: 
      extraEnv: 
        EMIT_KSM_V1_METRICS_ONLY: true  
        EMIT_KSM_V1_METRICS: false
        # The default config path is read only, for customizing we have to swap spots.
        CONFIG_PATH: "/tmp/custom-config"

      extraVolumeMounts:
        - mountPath: /tmp/custom-config
          name: custom-configs
    prometheus: 
      internal:
        enabled: true
        serviceName: svcname
        namespaceName: monitoring
        port: 9090
    ui: 
      enabled: true
      ingress: 
        enabled: true
        ingressClassName: "nginx"
        # -- Annotations for Ingress resource
        annotations: {}
          # kubernetes.io/tls-acme: "true"
        # -- A list of host rules used to configure the Ingress
        # @default -- See [values.yaml](values.yaml)
        hosts:
          - host: _____
            paths:
              - /
  extraVolumes:
  - name: custom-configs
    configMap:
      name: opencost-conf

The extra Configmap is used to disable the v1 kube state metrics.

apiVersion: v1
kind: ConfigMap
metadata:
  name: opencost-conf
data:
    default.json: |
        {
            "provider": "custom",
            "description": "Default prices based on GCP us-central1",
            "CPU": "0.031611",
            "spotCPU": "0.006655",
            "RAM": "0.004237",
            "spotRAM": "0.000892",
            "GPU": "0.95",
            "storage": "0.00005479452",
            "zoneNetworkEgress": "0.01",
            "regionNetworkEgress": "0.01",
            "internetNetworkEgress": "0.12"
        }
    metrics.json: | 
        {
            "disabledMetrics":[
                "kube_pod_owner",
                "kube_pod_labels",
                "kube_namespace_labels",
                "kube_node_labels",
                "kube_node_status_condition"
                ]
        }
        

For metrics, I'm using kube-prometheus-stack (with node-exporter and kube-state-metrics).

Problem

The cost model is exporting metrics for the same node with different instance/node labels (one for the node IP and another with the node name). This is a problem because the node_**_cost metrics have the node label value as the node name and the cost model ends up discarding the metrics with the IP. This image shows Node Exporter containers, but this happens for almost every pod/container.

OpenCost UI

image

Prometheus

image

I'm I doing anything wrong? Can anyone help me understand which metrics the cost model looks at?

MuriloCouceiro avatar Sep 13 '23 09:09 MuriloCouceiro

This issue has been marked as stale because it has been open for 180 days with no activity. Please remove the stale label or comment or this issue will be closed in 5 days.

github-actions[bot] avatar Mar 12 '24 01:03 github-actions[bot]

This issue was closed because it has been inactive for 185 days with no activity.

github-actions[bot] avatar Mar 17 '24 01:03 github-actions[bot]

Same issue here with 1.111.0

gaetanars avatar Aug 08 '24 09:08 gaetanars

We have the same issue with Opencost v1.111.0 installed using Opencost helm chart v1.41.0

rtnpro avatar Aug 19 '24 11:08 rtnpro

This issue has been marked as stale because it has been open for 180 days with no activity. Please remove the stale label or comment or this issue will be closed in 5 days.

github-actions[bot] avatar Feb 18 '25 02:02 github-actions[bot]

This issue was closed because it has been inactive for 185 days with no activity.

github-actions[bot] avatar Feb 23 '25 02:02 github-actions[bot]