DEV Community

Cover image for Setup OpenCost in Kubernetes using Helm
Yevhen Tienkaiev
Yevhen Tienkaiev

Posted on • Edited on

7 1 1

Setup OpenCost in Kubernetes using Helm

My setup is AWS and EKS.

My work based on:

I created custom helm chart based on OpenCost helm chart(official?) here is my default values.yaml:

fullnameOverride: opencost

awsSpotDataRegion: ""
awsSpotDataBucket: ""
awsAccountId: ""

opencost:
  serviceAccount:
    create: true
    annotations:
      eks.amazonaws.com/role-arn: "xxx"
  opencost:
    exporter:
      defaultClusterId: "xxx"
      extraEnv:
        EMIT_KSM_V1_METRICS: "false"
        EMIT_KSM_V1_METRICS_ONLY: "true"
        PROM_CLUSTER_ID_LABEL: cluster
        LOG_LEVEL: info #error
      extraVolumeMounts:
        - name: opencost-conf
          mountPath: /models/aws.json
          subPath: aws.json
    prometheus:
      external:
        enabled: true
        url: "http://mimir-nginx.mimir.svc.cluster.local:80/prometheus"
      internal:
        enabled: false
    ui:
      enabled: true
  extraVolumes:
    - name: opencost-conf
      configMap:
        name: opencost-conf
        items:
          - key: "aws.json"
            path: "aws.json"
Enter fullscreen mode Exit fullscreen mode

Also in my custom chart I included configmap.yaml, here is content of it:

apiVersion: v1
kind: ConfigMap
metadata:
  name: opencost-conf
data:
  aws.json: |
    {
        "provider": "custom",
        "description": "Default prices used to compute allocation between RAM and CPU. AWS pricing API data still used for total node cost.",
        "CPU": "0.031611",
        "spotCPU": "0.006655",
        "RAM": "0.004237",
        "GPU": "0.95",
        "spotRAM": "0.000892",
        "storage": "0.00005479452",
        "zoneNetworkEgress": "0.01",
        "regionNetworkEgress": "0.01",
        "internetNetworkEgress": "0.143",
        "spotLabel": "",
        "spotLabelValue": "",
        "awsServiceKeyName": "",
        "awsServiceKeySecret": "",
        "awsSpotDataRegion": "{{ .Values.awsSpotDataRegion }}",
        "awsSpotDataBucket": "{{ .Values.awsSpotDataBucket }}",
        "awsSpotDataPrefix": "",
        "athenaBucketName": "s3://x",
        "athenaRegion": "us-east-1",
        "athenaDatabase": "",
        "athenaTable": "",
        "projectID": "{{ .Values.awsAccountId }}"
    }
Enter fullscreen mode Exit fullscreen mode

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (1)

Collapse
 
wiwek13 profile image
wiwek13

what permission did you give to role?

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more