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

Instance/Node label duplicated for Node IP and name #115

Open
MuriloCouceiro opened this issue Sep 13, 2023 · 4 comments
Open

Instance/Node label duplicated for Node IP and name #115

MuriloCouceiro opened this issue Sep 13, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@MuriloCouceiro
Copy link

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?

Copy link

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 github-actions bot added the Stale label Mar 12, 2024
Copy link

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

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 17, 2024
@gaetanars
Copy link

Same issue here with 1.111.0

@rtnpro
Copy link

rtnpro commented Aug 19, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants