K8s 1.27 Update Pod requests/limits for running Pods

How Killercoda will be able to use this feature to improve performance in production

Kim Wuestkamp
2 min readMay 16, 2023

TL;DR

In this article we’ll:

  1. Describe the new feature “Update K8s Resources In-Place
  2. Allow you to see this in action simply in your browser
  3. Describe a production use-case where this feature will be used

What is possible now?

Let’s imagine we create a Pod like this:

Here we limit the CPU resources that Pod can use

Since K8s 1.27 it’s now possible to update the resources Requests/Limits of running Pods without the need for restarting them. This means we can simply run kubectl patch or kubectl apply with updated values:

Here we update the CPU resources that Pod can use, without restarting it

How awesome is this?! (The answer is: very awesome)

What are the requirements?

As this is still in Alpha state it requires the feature InPlacePodVerticalScaling to be enabled. For K3s it’s for example possible using:

curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.27.1%2Bk3s1 sh -s - --kube-apiserver-arg feature-gates=InPlacePodVerticalScaling=true

Can I see this in action?

Very glad you’re asking, yes you can! Simply head to the Killercoda scenario and test it out simply in your browser:

Production Use-Case

On Killercoda.com we create Sandbox Virtual Machine environments for teaching, learning, presenting or testing. As soon as the user opens their browser they’ll get access to a fresh VM. Read more about the Killercoda architecture here.

The workflow for an Ubuntu VM is something like this:

Workflow before K8s 1.27

  1. Create new Ubuntu VM KubeVirt Pod, limit Pod to 1 CPU
  2. Wait till the KubeVirt Pod/VM is ready
  3. Provide access to the user, User can use max 1 CPU

As you can see we have to limit the CPU resources that a Pod/VM is allowed to consume already at the very beginning, hence step 2 might be slow and causes longer load times.

Workflow since K8s 1.27:

  1. Create new Ubuntu VM KubeVirt Pod, limit Pod to 6 CPU
  2. Wait till the KubeVirt Pod/VM is ready
  3. Limit Pod to 1 CPU by updating the resources section in-place
  4. Provide access to the user, User can use max 1 CPU

Now we can use higher resources limits during setup/installation and add the final user limits later.

--

--

Kim Wuestkamp

killercoda.com | killer.sh (CKS CKA CKAD Simulator) | Software Engineer, Infrastructure Architect, Certified Kubernetes