You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Predict the cost of Kubernetes manifests (specs) in CI! Make cost decisions before
merging changes.
This is a GitHub Action, powered by Kubecost, to make cost predictions for K8s workloads before they are applied to your cluster. It does not require you to have Kubecost installed, but will produce highly-accurate, environment-specific predictions if you do.
Enhanced action — adds delta/diff mode, cost threshold enforcement, and budget checks on top of the base action
Base Action Usage
Add this Action as a step in one of your Actions workflows and point it at a single
YAML file or a directory containing at least one YAML file. Non-YAML files will be
ignored. The YAML files will be interpreted as Kubernetes manifests and a cost
prediction will be run on supported Kubernetes object types.
If you aren't familiar with GitHub Actions, check out GitHub's quickstart documentation.
Simple
- name: Run predictionid: predictionuses: kubecost/cost-prediction-action@v0.1.1with:
path: ./repo
- name: Find existing PR commentuses: kubecost/github-actions/find-comment@mainid: find-commentwith:
token: ${{ secrets.GITHUB_TOKEN }}issue-number: ${{ github.event.pull_request.number }}comment-author: 'github-actions[bot]'body-includes: '<!-- kubecost-prediction-results -->'
- name: Create or update PR comment with prediction resultsuses: kubecost/github-actions/create-or-update-comment@mainwith:
token: ${{ secrets.GITHUB_TOKEN }}issue-number: ${{ github.event.pull_request.number }}comment-id: ${{ steps.find-comment.outputs.comment-id }}edit-mode: replacebody: | <!-- kubecost-prediction-results --> ## Kubecost's total cost prediction for K8s YAML Manifests in this PR \``` ${{ steps.prediction.outputs.PREDICTION_TABLE }} \```
Only .yml/.yaml manifest files are supported. For Helm, run helm template first.
A limited set of Kubernetes object types are supported. More are planned.
Manifests without container resource requests will not produce predictions.
Delta mode requires fetch-depth: 0 in the checkout step so that the base branch is accessible.
Development
Source code for the prediction container is in the upstream Kubecost repo. Kubecost engineers: see cmd/costpredictionaction in KCM for development, testing, and releasing details.