Urgent.News

What's breaking now, across thousands of outlets.

Tech

Stop paying for the CPU your pods leave idle

Last year somebody set cpu: 1 on a Deployment. It felt safe. Today the process uses about a third of that core. The scheduler doesn't care. It holds the whole core on the node for every replica: at 3 a.m., all weekend, through every quiet hour of the month. Two thirds of that core sits reserved, doing nothing. For years the fix meant restarting the pod, so nobody bothered. That excuse is gone.…

A Kubernetes Deployment was inadvertently configured with a CPU request of 1 core. The scheduler reserved a third of that core for all replicas, leaving two thirds idle 24/7. The solution is now available in Kubernetes 1.33 and above via the In-place resize feature. Attune, a Kubernetes operator, automates this process by adjusting CPU requests in-place, freeing up reserved resources.

Attune reads metrics from Prometheus, calculates optimal CPU and memory requests, and then applies them to the target pods. It works by lowering the CPU request, keeping the existing connections, and giving the node back its reserved reservation. To install Attune, you need Kubernetes version 1.32 or newer. The policy is defined using a YAML file that specifies the target Deployment, metrics source (Prometheus), and target CPU and memory requests.

The policy is applied using the kubectl apply command. After the policy is in place, you can view the recommended CPU requests and estimated savings using the kubectl attune recommendations and kubectl attune savings commands. These commands show the difference between the current CPU request and the recommended value, along with an estimate of the monthly savings.

If a resized container is OOMKilled within 5 minutes, Attune reverts to the previous request. However, if the policy is set to "Recommend," it only suggests the new values without making any changes. This allows for manual review before applying the changes. It's important to note that an HPA (Horizontal Pod Autoscaler) that scales on CPU utilization could potentially negate the savings if the request is lowered.

To prevent this, set the HPA target with the annotation attune.io/auto-tune: true and ensure that the minimum allowed CPU request is high enough to avoid further reductions.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

ElevenLabs + React: Building a Voice-Enabled UI

Why Voice‑Enabled UI Matters Every day we interact with voice assistants, chatbots, and smart devices. Even if you’re a web developer who’s never written a line of code for speech, adding a voice…

  • Voice-enabled interfaces enhance accessibility and engagement.
  • ElevenLabs provides API for high-quality text-to-speech.
  • React integration involves backend handling of API authentication.

Smooth Page Transitions with the View Transitions API

The View Transitions API lets the browser animate between two states of your UI without you hand-writing FLIP animations.

  • View Transitions API enables smooth UI animations without manual FLIP animations
  • Implement same-document transitions with document.startViewTransition()
  • Cross-document transitions require @view-transition rule in both pages

More from Wednesday 4 November →