惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Engineering at Meta
Engineering at Meta
T
Threatpost
P
Palo Alto Networks Blog
NISL@THU
NISL@THU
O
OpenAI News
Project Zero
Project Zero
G
GRAHAM CLULEY
P
Privacy International News Feed
A
Arctic Wolf
Microsoft Azure Blog
Microsoft Azure Blog
H
Help Net Security
M
MIT News - Artificial intelligence
T
Threat Research - Cisco Blogs
S
Security @ Cisco Blogs
Google DeepMind News
Google DeepMind News
B
Blog RSS Feed
D
Docker
aimingoo的专栏
aimingoo的专栏
博客园 - 【当耐特】
N
Netflix TechBlog - Medium
云风的 BLOG
云风的 BLOG
雷峰网
雷峰网
W
WeLiveSecurity
P
Proofpoint News Feed
腾讯CDC
Cloudbric
Cloudbric
S
Secure Thoughts
C
Check Point Blog
博客园 - Franky
T
The Exploit Database - CXSecurity.com
T
Troy Hunt's Blog
GbyAI
GbyAI
Security Archives - TechRepublic
Security Archives - TechRepublic
Application and Cybersecurity Blog
Application and Cybersecurity Blog
月光博客
月光博客
C
Cyber Attacks, Cyber Crime and Cyber Security
I
Intezer
TaoSecurity Blog
TaoSecurity Blog
L
Lohrmann on Cybersecurity
V
Visual Studio Blog
F
Fortinet All Blogs
博客园 - 叶小钗
C
CXSECURITY Database RSS Feed - CXSecurity.com
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recorded Future
Recorded Future
C
Cisco Blogs
博客园 - 司徒正美
Stack Overflow Blog
Stack Overflow Blog
Y
Y Combinator Blog
Apple Machine Learning Research
Apple Machine Learning Research

Apptio

How IBM Apptio Delivers Data Center Value in the Age of AI - Apptio Managing K8s Agent Updates at Scale with Helm and Terraform - Apptio GitOps with IBM Kubecost: Preventing Argo CD Rollbacks - Apptio It’s Here: Meet the New IBM Apptio Report Studio – A Faster, More Intuitive Approach to Reporting - Apptio New Tech, Same Rules: Cloud Lessons for an AI Advantage - Apptio IBM Cloudability Advanced Containers for Kubernetes FinOps - Apptio The Next Era of IT Financial Management Reporting with the New IBM Apptio Report Studio - Apptio From Guesswork to Confidence: Introducing Intelligent Forecasting for Tech Spend Planning - Apptio Smarter Technology Spend with AI-Driven Financial Intelligence - Apptio Budgets Are Up, Confidence Isn't: 2026 Global Tech Investment Insights - Apptio IBM Kubecost 3.1: Kubernetes Resource Quota Rightsizing - Apptio Driving FinOps Forward in 2025 and Beyond - Apptio ITFM Maturity: The Next CIO Imperative in the Age of Innovation - Apptio How Banks Can Optimize IT Spend Without Sacrificing Impact - Apptio Introducing IBM Apptio Product TCO: Turn Product Spend into Strategic Investments with Clear, End-to-End Total Cost of Ownership and Unit Costs: Creating a Strategic Lens for IT Investment Decisions - Apptio Workforce Management: The Engine of Strategic Portfolio Management - Apptio FinOps for AI: Enabling the Next Wave of Cloud Innovation - Apptio IBM Kubecost 3.0: Faster, Smarter, and Built for Scale - Apptio Introducing IBM Apptio Mainframe TCO: Complete Visibility into Mainframe Costs and Usage - Apptio Essential K8s Cost Metrics for Reducing Spend - Apptio The New Standard for Strategic Portfolio Management: Financial Visibility at Every Level - Apptio K8s Cost Ownership: Who’s Responsible and How to Make It Work - Apptio Kubecost 2.8: Centralized Custom Pricing and a Big Performance Leap with ClickHouse - Apptio Unlock the Power of IT Financial Management with IBM Apptio Essentials - Apptio Full Transparency for Smart AI Investments with IBM Apptio’s AI Total Cost of Ownership & Usage - Apptio What’s New in IBM Apptio Planning - Apptio Labeling in Kubernetes: From Metadata to Money-Saving Insights - Apptio Innovative Approaches to Drive Tech Spend Management with AI, Analytics, and Automation - Apptio Discover Kubecost on Apptio’s Website: Enhancing FinOps with Kubernetes Insights - Apptio How Kubecost Collections Works: From the Engineers Who Built It - Apptio Kubecost 2.7 Release Highlights - Apptio Introducing Hybrid IT TCO Impact: IBM Apptio’s Newest Solution to Manage Your Evolving Hybrid Environment - Apptio FinOps Essentials: Best Practices for Finance Teams - Apptio Upgrading Your Kubecost Experience - Apptio Kubecost 2.6 Release Highlights - Apptio Kubernetes Efficiency: Cut Waste, Not Performance - Apptio FinOps Essentials: Best Practices for Product Teams - Apptio Optimizing GPU Monitoring for AI Efficiency - Apptio Kubecost 2.5 Release Highlights - Apptio FinOps Essentials: Strategies for Smarter Cloud Spending - Apptio Achieving Cost-Effective Scaling in Kubernetes - Apptio Celebrating OpenCost’s Journey to CNCF Incubation - Apptio Unlocking Technology Value: The Essential Role of TBM in Modern IT Management - Apptio The Complex Costs of AI: Investments, Funding, and ROI Tracking - Apptio Addressing Carbon Emissions in IT: The New Business Imperative - Apptio Kubecost Brings NVIDIA GPU cost monitoring for AI workloads in 2.4 - Apptio Kubecost Launches Support for Oracle Cloud - Apptio Kubecost 2.4 Release Highlights - Apptio Evolving Container Cost Visibility with IBM Cloudability - Apptio Transforming the Way You Manage Your Digital Portfolios: IBM Apptio and ServiceNow - Apptio Maximizing Kubernetes Cost Efficiency with Kubecost and Amazon EKS - Apptio FinOps Foundations: Strategies for Cross-Team Alignment - Apptio Managing Kubernetes Costs in a Multi-Cloud Environment - Apptio Unlock Kubernetes Savings with Kubecost’s Automated Actions - Apptio Celebrating a Milestone: Kubecost Surpasses 10 Million Installs - Apptio Kubernetes Pricing: On-Premises Versus Cloud Environments - Apptio Maximizing Multi-Cloud Efficiency with Kubecost APIs - Apptio Aligning Tech Financials and Labor Resources - Apptio Kubecost 2.3 Release Highlights - Apptio IBM Cloudability Introduces New Innovations for FinOps Practitioners - Apptio Kubecost Launches the First Kubecost Certification - Apptio Enhancing Cloud Reporting: Attributing Costs to Kubernetes Applications - Apptio Building a FinOps Solution for All - Apptio Navigating the Growing Complexities of Technology Spend Management - Apptio Apptio Introduces New Products to Elevate Technology Value - Apptio Developing a Strategy for Kubernetes Cost Monitoring - Apptio Visualize your Kubernetes Network Costs - Apptio Getting Highly Accurate and Granular Cost Metrics with Kubecost - Apptio 8 Steps to Achieve Enterprise Agile Planning Success - Apptio FinOps and TBM at Public Sector Summit - Apptio Introducing Kubecost Collections - Apptio Apptio & ServiceNow launch new Application Portfolio Management capabilities - Apptio Beyond the Hype: A Balanced View of AI Adoption - Apptio 2.1 Release Highlights - Apptio Starting your Technology Business Management Journey: A Guide for Smart Technology Investments with Apptio Cost Management - Apptio IBM Cloudability: 2023 Innovation in Review - Apptio Kubecost 2.0 Packaging - Apptio Kubernetes Readiness Probe: Tutorial & Examples - Apptio Kubernetes Health Check - How-To and Best Practices - Apptio Introducing Kubecost 2.0 - Apptio Kubernetes Liveness Probe: Tutorial & Examples - Apptio Kubernetes Cluster Size: Your Guide to Optimization - Apptio EKS Cost Monitoring: The Kubecost and AWS Solution - Apptio Kubernetes Deployment Strategies: Tutorial & Examples - Apptio Guide to Kubernetes Management Tools - Apptio Automate Your Rightsizing Workflows with IBM Cloudability and ServiceNow - Apptio Kyverno and Kubecost: Real-time Kubernetes Cost Management - Apptio Making Smarter IT Decisions With Apptio Plus ServiceNow Breaking Down Silos Between Finance and Agile Teams With Lean Budgeting - Apptio Maximize Cloud Savings Without Running Afoul of AWS RI Marketplace Enforcements - Apptio Cost-Effective Deployment Policies With Kyverno - Apptio Tracking Waste on Kubernetes Clusters - Apptio Blending FinOps With Observability - Apptio 3 Key Opportunities for Finance Teams in SAFe 6.0 - Apptio Kubecost Predict Part 2: Introducing the Admission Controller - Apptio The CEO as the Chief Transformation Officer - Apptio Client Challenge Client Challenge Client Challenge
GitOps with IBM Kubecost: API-Driven Rightsizing - Apptio
Mohammad Azharuddin · 2026-04-23 · via Apptio

Introduction

When using IBM Kubecost, the UI clearly shows valuable insights on running workloads more efficiently through Container Request Right-Sizing Recommendations. Inevitably, someone asks: “We use GitOps—how do we integrate these recommendations into our pipeline?”

This guide shows you how to programmatically apply Kubecost recommendations to your Argo CD-managed deployments using Kubecost APIs and a simple bash script.

Prerequisites

Before we begin, ensure you have:

The Challenge

Manual resource optimization doesn’t scale. Teams need a way to:

  • Continuously monitor resource usage
  • Get right-sizing recommendations based on actual usage
  • Automatically apply those recommendations through GitOps
  • Maintain a full audit trail and rollback capability

Let’s build an automated solution.

Step 1: Deploy a Sample Application

We’ll use the Kubernetes Guestbook application as our example.

Here’s the current deployment with over-provisioned resources:

apiVersion: apps/v1 
kind: Deployment 
metadata: 
name: guestbook-ui 
namespace: guestbook 
spec: 
replicas: 1 
selector: 
matchLabels: 
app: guestbook-ui 
spec: 
containers: 
- image: gcr.io/google-samples/gb-frontend:v5 
name: guestbook-ui 
resources: 
requests: 
cpu: "200m" 
memory: "256Mi" 
limits: 
cpu: "500m" 
memory: "512Mi" 

Notice the container requests 200m CPU and 256Mi memory. Let’s see what Kubecost recommends.

Step 2: Query the Kubecost API

Kubecost provides a powerful API endpoint for request sizing recommendations.

Here’s how to query it:

KUBECOST_ADDRESS='http://localhost:9090/model'  
 
curl -G \ 
-d 'algorithmCPU=max' \ 
-d 'algorithmRAM=max' \ 
-d 'targetCPUUtilization=0.65' \ 
-d 'targetRAMUtilization=0.65' \ 
-d 'window=3d' \ 
--data-urlencode 'filter=namespace:"guestbook"' \ 
${KUBECOST_ADDRESS}/savings/requestSizingV2 | jq '.Recommendations[].recommendedRequest' 

Key Parameters:

  • algorithmCPU/RAM: Set to max to use peak usage as the baseline
  • targetCPUUtilization: Target 65% CPU utilization (room for spikes)
  • targetRAMUtilization: Target 65% memory utilization
  • window: Analyze the past 3 days of metrics
  • filter: Scope recommendations to the guestbook namespace

More information on Kubecost’s recommendations.

Sample Response:

{ 
"cpu": "10m", 
"memory": "20Mi" 
} 

Kubecost recommends 10m CPU and 20Mi memory—a significant reduction from our current 200m/256Mi!

Step 3: Automate YAML Updates with Bash

Now let’s create a script that fetches recommendations and updates our deployment YAML:

#!/bin/bash 
set -e 
 
# Configuration 
KUBECOST_ADDRESS='http://localhost:9090/model' # Change this to your actual Kubecost address 
NAMESPACE='guestbook' # Change this to your actual namespace 
YAML_FILE="guestbook/deployment.yaml" # Change this to your actual YAML file path 
 
 
echo "Fetching recommendations from Kubecost..." 
 
# Get recommendations from Kubecost API 
RECOMMENDATIONS=$(curl -s -G \ 
-d 'algorithmCPU=max' \ 
-d 'algorithmRAM=max' \ 
-d 'targetCPUUtilization=0.65' \ 
-d 'targetRAMUtilization=0.65' \ 
-d 'window=3d' \ 
--data-urlencode "filter=namespace:\"$NAMESPACE\"" \ 
${KUBECOST_ADDRESS}/savings/requestSizingV2) 
 
# Extract values from first recommendation 
CONTAINER_NAME=$(echo "$RECOMMENDATIONS" | jq -r '.Recommendations[0].containerName') 
CPU=$(echo "$RECOMMENDATIONS" | jq -r '.Recommendations[0].recommendedRequest.cpu') 
MEMORY=$(echo "$RECOMMENDATIONS" | jq -r '.Recommendations[0].recommendedRequest.memory') 
 
# Check if we received valid data 
if [ "$CONTAINER_NAME" == "null" ] || [ -z "$CONTAINER_NAME" ]; then 
echo "Error: No recommendations found for namespace $NAMESPACE" 
exit 1 
fi 
 
echo "Updating container: $CONTAINER_NAME" 
echo "New CPU request: $CPU" 
echo "New Memory request: $MEMORY" 
 
# Update YAML 
yq eval -i " 
(.spec.template.spec.containers[] | select(.name == \"$CONTAINER_NAME\") | .resources.requests.cpu) = \"$CPU\" | 
(.spec.template.spec.containers[] | select(.name == \"$CONTAINER_NAME\") | .resources.requests.memory) = \"$MEMORY\" 
" "$YAML_FILE" 
 
echo "Successfully updated $YAML_FILE" 

What this script does:

  • Queries Kubecost for recommendations
  • Extracts the container name and recommended resources using jq
  • Updates the YAML file using yq (preserves formatting and comments)
  • Only modifies the requests section, leaving limits unchanged

Step 4: Integrate with GitOps

Now let’s push these changes to your Argo CD repository:

#!/bin/bash 
set -e 
 
# Configuration 
KUBECOST_ADDRESS='http://localhost:9090/model' 
NAMESPACE='guestbook' 
YAML_FILE="deployment.yaml" 
GIT_REPO_PATH="/path/to/argocd-repo" 
GIT_BRANCH="main" 
 
# Fetch recommendations (same as Step 3) 
RECS=$(curl -s -G \ 
-d 'algorithmCPU=max' \ 
-d 'algorithmRAM=max' \ 
-d 'targetCPUUtilization=0.65' \ 
-d 'targetRAMUtilization=0.65' \ 
-d 'window=3d' \ 
--data-urlencode "filter=namespace:\"$NAMESPACE\"" \ 
${KUBECOST_ADDRESS}/savings/requestSizingV2) 
 
CONTAINER=$(echo "$RECS" | jq -r '.Recommendations[0].containerName') 
CPU=$(echo "$RECS" | jq -r '.Recommendations[0].recommendedRequest.cpu') 
MEMORY=$(echo "$RECS" | jq -r '.Recommendations[0].recommendedRequest.memory') 
 
echo "Updating $CONTAINER: CPU=$CPU, Memory=$MEMORY" 
 
# Navigate to repo and update 
cd "$GIT_REPO_PATH" 
git pull origin "$GIT_BRANCH" 
 
# Update YAML 
yq eval -i " 
(.spec.template.spec.containers[] | select(.name == \"$CONTAINER\") | .resources.requests.cpu) = \"$CPU\" | 
(.spec.template.spec.containers[] | select(.name == \"$CONTAINER\") | .resources.requests.memory) = \"$MEMORY\" 
" "$YAML_FILE" 
 
# Check for changes 
if git diff --quiet; then 
echo "No changes detected" 
exit 0 
fi 
 
# Commit and push 
git add "$YAML_FILE" 
git commit -m "chore: update $CONTAINER resource requests 
 
Kubecost recommendations applied: 
- CPU: $CPU 
- Memory: $MEMORY 
 
Based on 3d usage analysis with 65% target utilization" 
 
git push origin "$GIT_BRANCH" 
 
echo "✓ Changes pushed to $GIT_BRANCH" 

Best Practices

1. Start Conservative:

  • Begin with a less aggressive target utilization (e.g., 50%)
  • Monitor workloads for at least 14 days to account for traffic spikes
  • Test in dev/staging environments before production
  • Monitor application performance after changes

2. Add Safety Rails:

# Add minimum thresholds 
MIN_CPU="5m" 
MIN_MEMORY="10Mi" 
 
if [ "$CPU" \< "$MIN_CPU" ]; then 
CPU="$MIN_CPU" 
fi 

3. Use Pull Requests: Instead of direct pushes, create PRs for manual review.

git checkout -b "kubecost-recommendations-$(date +%Y%m%d)" 
# ... make changes ... 
git push origin HEAD 
# Use GitHub CLI to create PR 
gh pr create --title "Kubecost recommendations" --body "..." 

4. Add Notifications: Integrate with Slack or Teams to notify when recommendations are applied.

Conclusion

By combining IBM Kubecost’s intelligent recommendations with GitOps automation, you can continuously optimize your Kubernetes resources without manual intervention. The script is extensible—add validation rules, notifications, or integrate with your CI/CD pipeline as needed.

For more information, visit the IBM Kubecost API documentation. To see this in action, check out our Monthly Kubechat webinar, Closing the Kubernetes Cost Loop with GitOps.