Skip to content

Add --subresource flag to kubectl set resources #1728

Open
kubernetes/kubernetes
#130979
@LarssonOliver

Description

@LarssonOliver

What would you like to be added:

Hi! 👋

I'd like the --subresources flag to be available in the kubectl set resources command.

Why is this needed:

Since 1.32, updating resources of running pods is done using the /resize subresource (see kubernetes/kubernetes#128266).

Pre-1.32, when using the InPlacePodVerticalScaling feature gate, resources of pods could be updated using the kubectl set resources command. Since this is no longer the case, we now have to use the following patch command:

kubectl patch pod nginx --subresource resize --patch '{"spec":{"containers":[{"name":"nginx","resources":{"requests":{"cpu":"2"},"limits":{"cpu":"4"}}}]}}'

If we add the --subresource flag to the set resources command, we would once again be able to use it to update the resources of running pods. Example:

kubectl set resources pod nginx --subresource resize --requests=cpu=2 --limits=cpu=4

An alternative solution could be that set resources automatically invokes the /resize subresource should the target resource of type be "pod".

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions