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

On-Premises Pricing - Further clarifications would be really nice #90

Closed
daniwk opened this issue Mar 13, 2023 · 10 comments
Closed

On-Premises Pricing - Further clarifications would be really nice #90

daniwk opened this issue Mar 13, 2023 · 10 comments
Assignees

Comments

@daniwk
Copy link
Contributor

daniwk commented Mar 13, 2023

The guide for providing pricing for on-promises pricing is unclear for newcomers to OpenCost. It would be really helpful and a timesaver if the guide contained a section where it's stated and shown how the custom pricing (default.json) is mounted to the opencost container in the deployment config.

Let me know you'd like me to create a PR where I give it go.

apiVersion: v1
kind: ConfigMap
metadata:
  name: opencost-conf
data:
  default.json: |
    {
      "provider": "custom",
      "description": "Default prices based on GCP us-central1",
      "CPU": "0.1",
      "spotCPU": "0.1",
      "RAM": "0.2",
      "spotRAM": "0.2",
      "GPU": "1",
      "storage": "0.3",
      "zoneNetworkEgress": "0.01",
      "regionNetworkEgress": "0.01",
      "internetNetworkEgress": "0.12"
    }
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: opencost
  labels:
    app: opencost
spec:
  replicas: 1
  selector:
    matchLabels:
      app: opencost
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: opencost
    spec:
      restartPolicy: Always
      serviceAccountName: opencost
      containers:
        - image: quay.io/kubecost1/kubecost-cost-model:latest
          name: opencost
          resources:
            requests:
              cpu: "10m"
              memory: "55M"
            limits:
              cpu: "999m"
              memory: "1G"
          env:
            - name: PROMETHEUS_SERVER_ENDPOINT
              value: "http://my-prometheus-server.prometheus.svc" # The endpoint should have the form http://<service-name>.<namespace-name>.svc
            - name: CLOUD_PROVIDER_API_KEY
              value: "AIzaSyD29bGxmHAVEOBYtgd8sYM2gM2ekfxQX4U" # The GCP Pricing API requires a key. This is supplied just for evaluation.
            - name: CLUSTER_ID
              value: "cluster-one" # Default cluster ID to use if cluster_id is not set in Prometheus metrics.
          imagePullPolicy: Always
          volumeMounts:
            - mountPath: /models/default.json
              name: opencost-defaults
              subPath: default.json
        - image: quay.io/kubecost1/opencost-ui:latest
          name: opencost-ui
          resources:
            requests:
              cpu: "10m"
              memory: "55M"
            limits:
              cpu: "999m"
              memory: "1G"
          imagePullPolicy: Always
      volumes:
        - name: opencost-defaults
          configMap:
            name: opencost-conf #
            items:
              - key: default.json
                path: default.json
@mattray mattray self-assigned this Mar 14, 2023
@mattray
Copy link
Collaborator

mattray commented Mar 14, 2023

I'm traveling this week but I'll get some docs cleaned up around this when I have access to my home cluster.

Related issues and examples:
opencost/opencost#1564
opencost/opencost#1747
opencost/opencost#1754
opencost/opencost#1760
https://github.com/calebcall/opencost/blob/main/deploys/deployment.yaml
https://github.com/calebcall/opencost/blob/main/deploys/configmap.yaml

@mattray
Copy link
Collaborator

mattray commented Mar 23, 2023

#93 updated the website at https://www.opencost.io/docs/on-prem#custom-pricing-using-the-opencost-helm-chart

I was able to update my aws.json and my default.json, I'll think about refactoring this page to make it a bit clearer what our options are.

@daniwk What would you like to see?

@mattray
Copy link
Collaborator

mattray commented Mar 23, 2023

opencost/opencost#1756 is related. I was able to override my AWS spot pricing

@daniwk
Copy link
Contributor Author

daniwk commented Apr 20, 2023

Sorry, for getting back to you so late.

After some work with OpenCost I was finally able to load our pricing model to OpenCost and tag nodes with different price SKUs. This required a bit investigation in the source code, OpenCost docs and KubeCost docs. In retrospect, I think it would be helpful for new users if the docs outline, as you say, what the different options are:

  • Default pricing. Explaining default pricing, how it works and how you can override the defaults.
  • Custom CSV Pricing. Explaining what it is (supplying your own price model), how you can provide your own model, how you assign nodes to different SKUs, how you can use the API to verify that OpenCost has assigned the different nodes with the correct SKU.
  • CPU and RAM cost. A section on how OpenCost allocates RAM and CPU cost (based on the ratio of CPU and RAM cost in default.json).

I'd be happy to contribute here.

@mattray
Copy link
Collaborator

mattray commented Apr 21, 2023

@daniwk we'd love to have additional documentation on this. Please let me know how I can help you out!

@lordofire
Copy link

Sorry, for getting back to you so late.

After some work with OpenCost I was finally able to load our pricing model to OpenCost and tag nodes with different price SKUs. This required a bit investigation in the source code, OpenCost docs and KubeCost docs. In retrospect, I think it would be helpful for new users if the docs outline, as you say, what the different options are:

  • Default pricing. Explaining default pricing, how it works and how you can override the defaults.
  • Custom CSV Pricing. Explaining what it is (supplying your own price model), how you can provide your own model, how you assign nodes to different SKUs, how you can use the API to verify that OpenCost has assigned the different nodes with the correct SKU.
  • CPU and RAM cost. A section on how OpenCost allocates RAM and CPU cost (based on the ratio of CPU and RAM cost in default.json).

I'd be happy to contribute here.

Hi @daniwk, thanks for the sharing on this. I do have a quick question on CPU and RAM cost section. From what I read in the code, the ratio could only be derived through CPU and RAM section in the default.json, like here, right? If I want to set it for our cluster, how do we come up with those values? Is that a heuristic value through practice or something we could adjust in a per SKU perspective? We are evaluating the opencost for on-prem cluster as well, and would like to know more about this.

@daniwk
Copy link
Contributor Author

daniwk commented May 2, 2023

That's correct, @lordofire. Or to be more precise: I arrived at the same conclusion after searching through the code and docs. I haven't found a way to adjust this ratio on a per SKU basis though. We are mostly concerned with the total node cost, and not the specific CPU and RAM costs, but I guess you could look at your procurement data and infer the CPU and RAM ratio from that.

@lordofire
Copy link

Hi @daniwk , thanks for sharing!

Could you please help explain how do you derive the ratio of cpu/memory unit price in your situation? In our on-prem DC, we do have some memory optimized instances (which means bigger memory, and less unit cost for per GB memory), so how to determine that will be a problem for us to proceed further. Also, it would be great if you could explain how do you only measure the total node cost without the specific CPU/RAM cost. In my situation, my goal of using opencost is to have a single metric to evaluate our usage cost vs TCO.

@daniwk
Copy link
Contributor Author

daniwk commented May 14, 2023

Sorry for getting back to you so late.

In short, we skipped the entire "try to find the ratio of cpu/memory unit price" because we have a lot of different SKUs and the ratio will depend on what SKU you choose. AFAIK, OpenCost doesn't support SKU specific cpu/memory ratio.

When it comes to assigning total node cost it seems we're in a different situation. I work in a cloud company offering compute and managed services. We therefore have a price sheet containing what each compute specification will cost so we're simply assigning these prices to the different nodes (through the Custom CSV provider).

@mattray
Copy link
Collaborator

mattray commented Oct 30, 2023

I'm marking this as complete with #159

@mattray mattray closed this as completed Oct 30, 2023
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

3 participants