DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Kubernetes Rolling Updates Are Lying to You — and Your Users Are Paying for It
  • Java 27 Makes G1 the Default Everywhere: How to Test Your Small Containers Before You Upgrade
  • A Non-Expiring AKS Deployment Token Could Read Secrets Across Three Namespaces
  • Node and Capacity Spillover: What Happens When Kubernetes Runs Out of Room

Trending

  • Beyond @Transactional: Solving the Dual-Write Problem in Distributed Microservices
  • Where Should a Transaction End? Designing Consistency Boundaries in Distributed Java Systems
  • A Reference Architecture for Constrained AI-Assisted Design
  • Implementing Idempotency in Distributed Spring Boot Applications Using MySQL

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Software Design and Architecture
  3. Containers
  4. Automating Kubernetes Workload Rightsizing With StormForge

Automating Kubernetes Workload Rightsizing With StormForge

StormForge automates Kubernetes workload rightsizing using machine learning to optimize resource utilization and performance.

By 
Sai Sandeep Ogety
DZone Core CORE ·
Jan. 06, 25 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
4.6K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

As Kubernetes workloads grow in complexity, ensuring optimal resource utilization while maintaining performance becomes a significant challenge. Over-provisioning leads to wasted costs, while under-provisioning can degrade application performance. StormForge offers a machine learning-driven approach to automate workload rightsizing, helping teams strike the perfect balance between cost and performance. 

This article provides a comprehensive guide to implementing StormForge for Kubernetes workload optimization.

Prerequisites

Before getting started, ensure you have a working Kubernetes cluster (using tools like minikube, kind, or managed services like RKS, GKE, EKS, or AKS). You’ll also need Helm, kubectl, and the StormForge CLI installed, along with an active StormForge account. A monitoring solution like Prometheus is recommended but optional.

Set Up Your Environment

Ensure Kubernetes Cluster Access

Have a working Kubernetes cluster (e.g., Minikube, Kind, GKE, EKS, or AKS).

Confirm cluster connectivity:

Shell
 
kubectl get nodes


Install Helm

Verify Helm installation:

Shell
 
helm version


Install Helm if needed by following Helm Installation Instructions.

Deploy a Sample Application

Use a simple example application, such as Nginx:

Shell
 
kubectl apply -f https://k8s.io/examples/application/deployment.yaml


Confirm the application is running:

Shell
 
kubectl get pods


Install the StormForge CLI

Download and install the StormForge CLI:

Shell
 
curl -fsSL https://downloads.stormforge.io/install | bash


Authenticate the CLI with your StormForge account:

Shell
 
stormforge login


Deploy the StormForge Agent

Use the StormForge CLI to initialize your Kubernetes cluster:

Shell
 
stormforge init


Verify that the StormForge agent is deployed:

Shell
 
kubectl get pods -n stormforge-system


Create a StormForge Experiment

Define an experiment YAML file (e.g., experiment.yaml):

YAML
 
apiVersion: optimize.stormforge.io/v1
kind: Experiment
metadata:
  name: nginx-optimization
spec:
  target:
    deployments:
    - name: nginx-deployment
      containers:
      - name: nginx
        requests:
          cpu: "100m"
          memory: "128Mi"
        limits:
          cpu: "500m"
          memory: "256Mi"


Apply the experiment configuration:

Shell
 
stormforge apply -f experiment.yaml


Run the Optimization Process

Start the optimization:

Shell
 
stormforge optimize run nginx-optimization


Monitor the progress of the optimization using the CLI or StormForge dashboard.

Review and Apply Recommendations

Once the optimization is complete, retrieve the recommendations:

Shell
 
stormforge optimize recommendations nginx-optimization


Update your Kubernetes deployment manifests with the recommended settings:

Shell
 
requests:
  cpu: "200m"
  memory: "160Mi"
limits:
  cpu: "400m"
  memory: "240Mi"


Apply the updated configuration:

Shell
 
kubectl apply -f updated-deployment.yaml


Validate the Changes

Confirm that the deployment is running with the updated settings:

Shell
 
kubectl get pods


Monitor resource utilization to verify the improvements:

Shell
 
kubectl top pods


Integrate with Monitoring Tools (Optional)

If Prometheus is not installed, you can install it for additional metrics:

Shell
 
helm install prometheus prometheus-community/prometheus


Use Prometheus metrics for deeper insights into resource usage and performance.

Automate for Continuous Optimization

Set up a recurring optimization schedule using CI/CD pipelines. Then, regularly review recommendations as application workloads evolve.

Conclusion

StormForge provides an efficient and automated solution for optimizing Kubernetes workloads by leveraging machine learning to balance performance and resource utilization. By following the step-by-step guide, you can easily integrate StormForge into your Kubernetes environment, deploy experiments, and apply data-driven recommendations to rightsize your applications. 

This process minimizes costs by eliminating resource wastage and ensures consistent application performance. Integrating StormForge into your DevOps workflows enables continuous optimization, allowing your teams to focus on innovation while maintaining efficient and reliable Kubernetes operations.

Kubernetes

Opinions expressed by DZone contributors are their own.

Related

  • Kubernetes Rolling Updates Are Lying to You — and Your Users Are Paying for It
  • Java 27 Makes G1 the Default Everywhere: How to Test Your Small Containers Before You Upgrade
  • A Non-Expiring AKS Deployment Token Could Read Secrets Across Three Namespaces
  • Node and Capacity Spillover: What Happens When Kubernetes Runs Out of Room

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook