-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Collect and expose runtime's image storage usage via Kubelet's /stats/summary endpoint #23595
Conversation
GCE e2e build/test passed for commit c8c7c82971899545d5a4302b53c62580f2a945b1. |
@timstclair: Can you do an initial review? |
GCE e2e build/test passed for commit 008b5221cfcb0f0297b3ff83a5f3fb27714b9eb2. |
@@ -31,7 +31,7 @@ | |||
"/hyperkube", | |||
"apiserver", | |||
"--service-cluster-ip-range=10.0.0.1/24", | |||
"--insecure-bind-address=127.0.0.1", | |||
"--insecure-bind-address=0.0.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks unrelated? Also, doesn't this expose the insecure outside the local machine? Intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. Reverting this..
Finished review pass. |
Is the intention to look at the total size to see if it's even worth evicting some images? The size of all images won't help decide what image to evict. |
/cc @Random-Liu, this will affect your PR #23506 to switch to using docker engine-api |
Yes. In a separate PR, I plan on cleaning up the image GC logic as well. |
@timstclair: Thanks for the review. Addressed all comments. |
GCE e2e build/test passed for commit 0c4b18e2a38198ee0604f56f6c212412ca5aac6b. |
@timstclair Just did a rebase. PTAL when you get a chance. |
GCE e2e build/test failed for commit 7faccbb2ef1d8cce1c9cacb4eb23355e22f2bfd0. Please reference the list of currently known flakes when examining this failure. If you request a re-test, you must reference the issue describing the flake. |
if !imageMap.Has(key) { | ||
ret.TotalStorageBytes += uint64(layer.Size) | ||
} | ||
imageMap.Insert(key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this mean we'll only add the first layer for each image? Is that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the unit tests still pass with this? If it's not intentional and the tests do still pass, please update the tests to fail on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. history
contains all the layers for an image. Let's look at an example:
$ docker history bef5c7a893fd
IMAGE CREATED CREATED BY SIZE COMMENT
bef5c7a893fd 4 days ago /bin/sh -c #(nop) ENTRYPOINT ["/usr/bin/cadvi 0 B
5714946567e8 4 days ago /bin/sh -c #(nop) EXPOSE 8080/tcp 0 B
d5092c6dfc49 4 days ago /bin/sh -c #(nop) ADD file:5047bc1f57482bfdc9 23.75 MB
fb1790e81294 4 days ago /bin/sh -c apk add --update ca-certificates d 19.99 MB
3d239f12c85f 4 weeks ago /bin/sh -c #(nop) ENV GLIBC_VERSION=2.23-r1 0 B
86fbae24586c 4 weeks ago /bin/sh -c #(nop) MAINTAINER dengnan@google.c 0 B
342c0650e86b 7 weeks ago /bin/sh -c #(nop) ADD file:cda4b589f22e7984e3 5.258 MB
For this example, history would be a list of layer elements where each line in the output above matches a layer.
The key for each layer will be mostly unique, expect for the <missing>
case, which is handled by using the Created By
field. That field is expected to contain the command that was run for that layer and hence it must be unique.
Am I misreading my code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry, my mistake. I misread key
as the image key, not the layer key. What you have makes sense.
LGTM, needs rebase. |
add image fs info to summary stats API. Adding node e2e test for image stats. Signed-off-by: Vishnu kannan <vishnuk@google.com>
Just did a rebase. I'm adding the lgtm label again. FYI @timstclair |
GCE e2e build/test passed for commit e566948. |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e build/test passed for commit e566948. |
Automatic merge from submit-queue |
Just FYI, the perfdash shows that this PR increases the runtime CPU usage by about 0.05 cores (from 0.3 cores to 0.35 cores). |
What build was this? I couldn't find it. |
IIUC, the PR lists the images and invoke |
@yujuhong Agree. We could file an issue for this, :) |
This information is useful to users since docker images are typically not stored on the root filesystem.
Kubelet will also consume this feature in the future to decide is evicting images will help with disk usage on the nodes.
cc @kubernetes/sig-node