Comments (7)
Regardless, it seems like a pretty bad way to show the node resource usage when you do kubectl describe node
.
I'm not sure if that is kubectl formatting the quantity or if it comes from the API already formatted 👀
from kubectl.
This issue is currently awaiting triage.
SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted
label.
The triage/accepted
label can be added by org members by writing /triage accepted
in a comment.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
from kubectl.
Did some digging and I can indeed find one pod whose req/limits for cpu/mem respectively in the same column shows:
ns one-pod-xxxx 151m (0%) 4500m (28%) 195454566400m (0%)
and searching through deployments I did find this request for memory 🙃
limits:
cpu: "4"
memory: 4Gi
requests:
cpu: 1m
memory: 107374182400m
so in short, possibly my fault. not sure how this got there.
on the other hand, it's reasonable to want a human readable number in a human readable page?
from kubectl.
oh, wait, i see now, in my root yaml it says:
requests:
cpu: 1m
memory: 0.1Gi
which means 0.1Gi of memory gets converted to millibytes because it's not perfectly roundable;
> 0.1*1024*1024*1024*1000
107374182400
and this rounding based sub-byte number is then probably propagating through internal calculations 🙃
so this does not feel like a huge user error (0.1Gi feels like a reasonable way to represent memory), but it leads to hard to read kubectl describe
output. maybe kubectl describe
should give you Megabytes as a smallest default for memory, perhaps?
from kubectl.
I see the same thing, and also get a warning. Here is what I did:
$ kubectl apply -f - << EOF
apiVersion: v1
kind: Pod
metadata:
name: foo
spec:
containers:
- image: registry.k8s.io/pause
name: pause
resources:
requests:
cpu: 1m
memory: 0.1Gi
EOF
Warning: spec.containers[0].resources.requests[memory]: fractional byte value "107374182400m" is invalid, must be an integer
pod/foo created
$ kubectl get pod foo -o json | jq .spec.containers[0].resources
{
"requests": {
"cpu": "1m",
"memory": "107374182400m"
}
}
Are you able to use G
instead of Gi
?
$ kubectl apply -f - << EOF
apiVersion: v1
kind: Pod
metadata:
name: foo
spec:
containers:
- image: registry.k8s.io/pause
name: pause
resources:
requests:
cpu: 1m
memory: 0.1G
EOF
pod/foo created
$ kubectl get pod foo -o json | jq .spec.containers[0].resources
{
"requests": {
"cpu": "1m",
"memory": "100M"
}
}
from kubectl.
The warning is probably missed for most people who are using an automated CI environment; no one sees it unless it prevents it from being applied.
or if it comes from the API already formatted
ran kubectl get thatpod -v=15
and can see it is initially formatted in the response body line:
61421 request.go:1212] Response Body: {"kind":"Pod","apiVersion":"v1",
...
"requests":{"cpu":"1m","ephemeral-storage":"500Mi","memory":"107374182400m"}},"
...
but this is also not meant to be human readable, i guess?
from kubectl.
It looks like requests/limits are parsed into a Quantity type.
From there, it has some functions that looks like it supports different "scales", so allowing for the conversion between different units.
For kubectl describe pod
the code to print resource limits and requests is here (There is similar code for kubectl describe node
in this same file):
https://github.com/brianpursley/kubernetes/blob/9d945ba5a520438ac8cf7a77200ae6a8d2d8bd4b/staging/src/k8s.io/kubectl/pkg/describe/describe.go#L1881-L1898
So there should be the ability to detect and handle the display format, if it can be decided how it should be done. Is it just detecting when memory is fractional and rounding up to bytes? So in the case of 107374182400m
that becomes 107374183
I suppose it could also print a warning in the describe output saying that a fractional byte quantity was detected.
Ideally, resources should not specify memory or storage quantities this way at all, since there isn't really any meaning to a fractional byte.
from kubectl.
Related Issues (20)
- No tab completion available for kubectl set command HOT 3
- WarningHandler cannot be configured when applying HOT 14
- kubectl diff fails to detect deletions made in manifest after kubectl create HOT 4
- kubectl apply --dry-run=client attempts to connect to the server HOT 7
- kubectl explain template fails when array includes boolean value HOT 7
- Please finish removing 'kubectl get all' HOT 5
- kubectl returns kind: ValidatingAdmissionPolicyList for empty list of policies HOT 18
- "kubectl get" does not behave like its help description says it will. HOT 4
- error when deploying 'e2e-test-images/agnhost' via "Hello Minikube" tutorial on Windows HOT 10
- Improve tests for container-name autocompletion for exec commands HOT 4
- kubectl diff fails to detect differences in Service objects HOT 6
- Confirmation Prompt for Delete Commands HOT 6
- Symlink support for kubectl apply --recursive=true HOT 7
- Add optional full yaml paths to `kubectl explain` output HOT 3
- --disable-compression makes request to localhost instead to the kubernetes API when kubectl is running in-cluster HOT 5
- kube-apiserver drops connection from kubectl after 1 minute HOT 4
- kubectl get: when resource name is in form resource_type/name the error occurs HOT 10
- Add `--profile` to `kubectl run` HOT 9
- Extended resources provide usage display HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kubectl.