kubernetes / kubernetes/kubectl

The resources.limits.memory unit is automatically converted. Why cannot the unit be displayed as configured?

Open
#1,729 16 comments 0 reactions 0 assignees View on GitHub
kind/feature lifecycle/rotten sig/cli triage/needs-information
Dominant language
Go
Stars
3.3k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

### What happened?

When resources.limits.memory is set to 1237.3Mi, the actual pod is 1297403084800 m by running the kubectl command, which is difficult to understand.

### What did you expect to happen?

Resources.limits.memory can be displayed based on the configured value and unit.

### How can we reproduce it (as minimally and precisely as possible)?

Set resources.limits.memory to 1237.3Mi and run the kubectl command to check the value.

### Anything else we need to know?

_No response_

### Kubernetes version

```console
$ kubectl version
# paste output here
```
1.31

### Cloud provider

### OS version

```console
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
```

### Install tools

### Container runtime (CRI) and version (if applicable)

### Related plugins (CNI, CSI, ...) and versions (if applicable)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with resources.limits.memory set to 1237.3Mi, then run the kubectl command described in the report and trace where the configured quantity is converted for display. Done means kubectl presents the memory value in the configured unit rather than only the converted integer value.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.