Skip to content

Conversation

sanposhiho
Copy link
Member

@sanposhiho sanposhiho commented Mar 6, 2023

The container resource metrics is planning to get graduated to beta in v1.27. So, the feature will be available for many people by default.
It’s worth sharing this feature and the motivation for people since this feature is very important to configure safe HPAs for Pod with multiple containers.


ref: kubernetes/enhancements#1610

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 6, 2023
@sanposhiho
Copy link
Member Author

/area blog

@k8s-ci-robot k8s-ci-robot added area/blog Issues or PRs related to the Kubernetes Blog subproject size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 6, 2023
@sanposhiho
Copy link
Member Author

/sig autoscaling

@k8s-ci-robot k8s-ci-robot added the sig/autoscaling Categorizes an issue or PR as relevant to SIG Autoscaling. label Mar 6, 2023
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. language/en Issues or PRs related to English language sig/docs Categorizes an issue or PR as relevant to SIG Docs. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 21, 2023
@sanposhiho sanposhiho marked this pull request as ready for review March 21, 2023 08:38
@sanposhiho sanposhiho changed the title WIP: HPA container resource metrics blog Add the blog post for the beta graduation of HPA ContainerResource type metric Mar 21, 2023
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 21, 2023
@sanposhiho
Copy link
Member Author

/sig autoscaling

@sanposhiho
Copy link
Member Author

/cc @gjtempleton @mwielgus @pbetkier

@netlify
Copy link

netlify bot commented Mar 21, 2023

Pull request preview available for checking

Built without sensitive environment variables

Name Link
🔨 Latest commit 2d0f3d4
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-io-main-staging/deploys/64196cf11e614500082b2d1b
😎 Deploy Preview https://deploy-preview-39822--kubernetes-io-main-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Mar 21, 2023

Pull request preview available for checking

Built without sensitive environment variables

Name Link
🔨 Latest commit cbac72f
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-io-main-staging/deploys/645198f93e7f2a00081dbd59
😎 Deploy Preview https://deploy-preview-39822--kubernetes-io-main-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Member

@gjtempleton gjtempleton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of more general points:

  • I think we should call out the changes made by kubernetes/kubernetes#116045 given the potential for users to be looking at these events.
  • Could we introduce more detail on the metrics, including the labels on the metrics?

Comment on lines 59 to 64
## What's new for the beta?

For Kubernetes v1.27, the ContainerResource type metric will be available by default as described at the beginning.
(You can still disable it by the `HPAContainerMetrics` feature gate.)

On the instrumentation side, the kube-controller-manager reports the following new metrics([ref1](https://github.com/kubernetes/kubernetes/pull/116326), [ref2](https://github.com/kubernetes/kubernetes/pull/116010)):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make clearer that this is a benefit even for those who won't make use of the promotion of the ContainerResources to beta.

In case a Pod has multiple containers, the utilization calculation would be:

```
sum{the resource usages of each container} / sum{the resource request of each container}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sum{the resource usages of each container} / sum{the resource request of each container}
sum{the resource usage of each container} / sum{the resource request of each container}

In case a Pod has multiple containers, the utilization calculation would be:

```
sum{the resource usages of each container} / sum{the resource request of each container}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sum{the resource usages of each container} / sum{the resource request of each container}
sum{the resource usage of each container} / sum{the resource request of each container}


So, even if one container's resource utilization goes high, the Resource type metric may not suggest scaling up.

If your Pod has multiple containers, you may want to use the ContainerResource type metric instead for the accurate autoscaling.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth explicitly calling out an example where this might be useful (e.g. a logging or metrics sidecar)?

The ContainerResource type metric allows us to configure the autoscaling based on resource usage of individual containers.

In the following example, the HPA controller scales the target
so that the average utilization of the cpu in the application container of all the pods is 60%.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This risks being slightly misleading, I would recommend linking out to the more detailed discussion of the algorithm in our docs given the edge cases including tolerance etc.

@harshitasao
Copy link
Contributor

Hello, Comms Lead for the 1.27 release here. This feature blog is tracked for release, the deadline for submitting the draft is on 4th of April- the sooner the better since there's still editing to be done afterwards. Any doubt, the Comms team is here to help.
Thank you!

@sanposhiho
Copy link
Member Author

@gjtempleton Thanks for reviews, please retake a look when have time 🙏

@harshitasao
Copy link
Contributor

Hello, Comms Lead for v1.27 here. The publication order and date for the Feature Blog series has been finalized and the tracking board is updated.

The publication date for this article is 02-05-2023 (May 02).

Thank you!

---
layout: blog
title: "HPA ContainerResource type metric moves to beta"
date: 2023-04-11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
date: 2023-04-11
date: 2023-05-02

Please also change the file path to match the new date.

@harshitasao
Copy link
Contributor

@sanposhiho, friendly reminder for the above fixes.

@sanposhiho
Copy link
Member Author

Ah, sorry for unnotice. I'll give a quick fix.

@nate-double-u
Copy link
Contributor

A couple of things could be improved with spelling and word choice. Still, given its publication date is today, and we are already pushing other blog posts out, I'd like to approve this -- especially since it has a technical LGTM.

Reapplying @gjtempleton's tech lgtm:
/lgtm

Approving from a tech docs lens:
/approve

I'll open a PR to update the spelling and grammar shortly after approval.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 2, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 087d203d485e7be473d334853006185776b88552

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nate-double-u

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 2, 2023
sftim
sftim previously requested changes May 2, 2023
Copy link
Contributor

@sftim sftim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few, important fixes.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 2, 2023
@k8s-ci-robot k8s-ci-robot requested a review from nate-double-u May 2, 2023 23:11
Copy link
Contributor

@sftim sftim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's late, but perhaps still better to ship than not.

/lgtm
/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 2, 2023
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 2, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 3ea576cdefd8149537e727299e1c10fab1775c63

@sftim sftim dismissed their stale review May 2, 2023 23:13

Review was stale due to maintainer changes

@sftim
Copy link
Contributor

sftim commented May 2, 2023

/label tide/merge-method-squash

@k8s-ci-robot k8s-ci-robot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label May 2, 2023
@k8s-ci-robot k8s-ci-robot merged commit 73437c2 into kubernetes:main May 2, 2023
@sanposhiho
Copy link
Member Author

Thanks everyone for handling this 🙏

DonatoHorn pushed a commit to DonatoHorn/website that referenced this pull request Jun 25, 2023
…pe metric (kubernetes#39822)

* Add the blog post for the beta graduation of HPA ContainerResource type metric

* fix based on reviews

* fix based on the suggestion

* fix based on review

* update date

* Apply changes from code review

Co-authored-by: Nate W. <[email protected]>

* Push back publication date and timezone

---------

Co-authored-by: Tim Bannister <[email protected]>
Co-authored-by: Nate W. <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/blog Issues or PRs related to the Kubernetes Blog subproject cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. language/en Issues or PRs related to English language lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/autoscaling Categorizes an issue or PR as relevant to SIG Autoscaling. sig/docs Categorizes an issue or PR as relevant to SIG Docs. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

Status: Published

Development

Successfully merging this pull request may close these issues.

8 participants