2 minute read

Kubecost is advancing in predictive cost management in the form of the new Kubecost GitHub Action. This new solution allows you to see the cost of Kubernetes manifests directly on your PR before merging. By providing a cost estimate ahead of time, you can avoid costly overallocation. This is an extension of our previous Resource Cost Predict feature (see above), which is now built into GitHub to help developers wherever they work.

Although Kubecost does not need to be installed in order to use this Action, it can provide more accurate cost information in your output if installed. Get started in minutes for free.

What is GitHub Actions?

GitHub Actions is a platform for automating software workflows, enabling developers to create custom workflows to automate their software development process. Workflows can be triggered automatically by events or manually triggered. Common workflows include building, testing, and deploying code. Additionally, GitHub Actions is integrated with the GitHub platform, which provides collaboration and version control.

How does Kubecost’s GitHub Action work?

Kubecost offers a multitude of tools to help you reduce spend including cost visualization, right-sizing for containers and clusters, as well as detecting unused or underutilized resources. However, until now, you had to spend first in order to get value. With the introduction of proactive savings features like Kubecost Predict, you can now make informed cost decisions before you make a change or request additional resources. This enables application developers to better understand the cost implications of their decisions, ultimately leading to greater savings and more efficient resource allocation.


Below is an excerpt from a workflow written with this Action. This is the easiest way to add Kubernetes cost prediction to your CI

- name: Run prediction
  id: prediction
  uses: kubecost/cost-prediction-action@v0.1.1
    # Set this to the path containing your YAML specs. It can be a single
    # YAML file or a directory. The Action will recursively search if this
    # is a directory and process all .yaml/.yml files it finds.
    path: ./repo

# Write/update a comment with the prediction results.
- name: Update PR with prediction results
  uses: edumserrano/find-create-or-update-comment@v1
    issue-number: $
    body-includes: '<!-- kubecost-prediction-results -->'
    comment-author: 'github-actions[bot]'
    edit-mode: replace
    body: |
      <!-- kubecost-prediction-results -->
      ## Kubecost's total cost prediction for K8s YAML Manifests in this PR


The github-actions bot will then comment on your PR to provide a total cost prediction for your manifest, divided by object, as seen below:

Github Actions comment

If you want a premade workflow file to experiment with, check out this advanced example.

See also

For those interested in additional developer cost tools, check out kubectl cost, our kubectl plugin which provides CLI access to Kubernetes cost info.


With this new GitHub Action, Kubecost is now making it even easier to prevent excessive spend and create a culture of cost savings. You can learn more about our New Github Action [here] (https://github.com/kubecost/cost-prediction-action) and get up and running with Kubecost in minutes for free.