kubernetes / kubernetes/kubectl

`kubectl describe` sometimes shows memory in millibytes

Open
#1,597 14 comments 0 reactions 2 assignees Claimed by @CodeWithNed View on GitHub
kind/bug triage/accepted
Dominant language
Go
Stars
3.3k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

via `kubectl describe node XXX`:

Screenshot 2024-05-08 at 14 02 49

This can happens when some pods request sub-byte memory accidentally.

I saw a pod requesting `0.1Gi` of memory.

```yaml
requests:
cpu: 1m
memory: 0.1Gi
```

which shows up in kubernetes as:

```yaml
limits:
cpu: "4"
memory: 4Gi
requests:
cpu: 1m
memory: 107374182400m
```

This phenomenon happens here because 10 does not divide a perfect power of 2:

```js
> 0.1*1024*1024*1024*1000
107374182400
```

This sub-byte number propagates throughout and is visible in the `descibe node` output as above, as well as the `describe pod` output.

**Expected Behaviour**:
Rounding to nearest actual unit (bytes) or a human readable output with 3 significant digits on the biggest unit.

**Environment**:
EKS 1.29, kubectl client at 1.30.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.