visit
[A completed Argo workflow, its costs completely unknown]
Enter Kubecost, Argo’s spend-conscious companion Kubecost, a Kubernetes cost monitoring tool with a , enables dev teams to accurately measure Argo workflow costs in real-time, allocate costs to teams, recognize resource efficiencies, and suggest opportunities for optimization.
Once installed, Kubecost will collect cost data on running Argo Workflows.
Create an example workflow For this guide, let’s define an Argo Workflow by creating a WorkflowTemplate CRD. We’ll make the workflow mimic high resource usage by having the Docker container make resource-consuming Pods. The workflow will perform its single “stress” stage, running the stress-ng image, along with inputs Argo will handle in the launched workflow. To create the WorkflowTemplate CRD in the Argo namespace, save the following yaml to a file and run argo template create $filename -n argo.
The workflow requests 1200m CPU and 40M memory, while the running stress-ng container uses 1 CPU and 30M memory. That gap represents wasteful inefficiency, as the over-provisioned container uses more cluster compute resources than it requires to operate.
Measure Kubernetes costs with Kubecost Because Argo Workflow jobs all feature the metadata label , viewing each workflow’s costs and efficiency metrics within Kubecost is simple. In the Kubecost UI, go to the Cost Allocation page and change the “Aggregate By” field to “Label: workflows_argoproj_io_workflow.” This will display the following per-workflow cost and efficiency data:
Use the kubectl-cost CLI for quick cost inspection
Clusters with Kubecost installed are available for inspection using the kubectl-cost CLI tool as well as the UI. Use Krew to install kubectl-cost:
kubectl krew install cost
In the CLI, workflow costs are available with the command kubectl cost label --label
Boost the precision of cost insights