davidB / kubectl-view-allocations

kubectl plugin to list allocations (cpu, memory, gpu,... X utilization, requested, limit, allocatable,...)

Home Page:https://crates.io/crates/kubectl-view-allocations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

On azure free show as 0

mercer opened this issue · comments

Output

image

Versions

image

image

Metric server (comes from aks)

image

In the default namespace they are no pods, or none of the pod define requested CPU or memory ?
If yes, there is a bug in the aggregation that should return None and not 0.

Most of the pods (non system) are in default.

But the 0 in the report is in the sum, so all namespaces together.

image

I guess the command used for the screenshot above is kubectl top pod. This command show the utilization not what resources is requested (as defined in the manifest).
If you want to display utilization use the option -u (it is not enabled by default, because it's a new option and only available if server-api is enabled on your cluster, that is your case else top pod failed).

❯ kubectl view-allocations -g namespace -u
Resource                 Utilization     Requested         Limit  Allocatable     Free
  cpu                      (0%) 73.0m   (6%) 950.0m   (1%) 100.0m         16.0     15.1
  ├─ kube-system                72.0m        950.0m        100.0m           __       __
  └─ local-path-storage          1.0m            __            __           __       __
  ephemeral-storage                __  (0%) 100.0Mi            __      468.4Gi  468.4Gi
  └─ kube-system                   __       100.0Mi            __           __       __
  memory                 (1%) 451.4Mi  (1%) 290.0Mi  (1%) 390.0Mi       31.3Gi   30.9Gi
  ├─ kube-system              443.2Mi       290.0Mi       390.0Mi           __       __
  └─ local-path-storage         8.2Mi            __            __           __       __
  pods                             __     (9%) 10.0     (9%) 10.0        110.0    100.0
  ├─ kube-system                   __           9.0           9.0           __       __
  └─ local-path-storage            __           1.0           1.0           __       __

Else to help debug the "0.0" as the sum for values (for declared Requested CPU & Memory), Can you share with me the output of (you can ofuscate the name of pod) of kubectl view-allocations --namespace default -r cpu -r memory --show-zero ?

I picked 2 other namespaces, that don't have business in them, and I don't have to edit. Here I expected

  1. free memory per node to be the same in both reports per node
  2. free cpu to be non-zero value in both reports per node

image

image

Sorry, I misunderstood your request, I don't understood you talk about the "Free" column.
No "it's not a bug, it's a feature :-D". The original purpose of the plugin is to track Resources allocations/provisioning (declared via manifest). And it's also the case for free, from the README

Free : Allocatable - max (Limit, Requested)

In your case Limit are > Allocatable so you have 0 free.

If you are interested by the current utilization (lile kubectl top node), use the -u/--utilization flag, it will not change the formula for Free, but will add a column Utilization whre you should retrieve information from top (+/- the aggregation function could differ and it's a snapshot of current state).

Thanks for your feedback, I was confused of the meaning of Free.

Utilization works as advertised, however, I do see an issue here.

kubectl top node reports 100% memory utilization, while view-allocations reports 75%. Perhaps you are using the capacity instead of allocatable 🤔

➜  ~ kubectl describe node aks-nodepool-REDACTED-vmss000000
Name:               aks-nodepool-REDACTED-vmss000000
Roles:              agent
Capacity:
  attachable-volumes-azure-disk:  4
  cpu:                            2
  ephemeral-storage:              129900528Ki
  hugepages-1Gi:                  0
  hugepages-2Mi:                  0
  memory:                         8152804Ki
  pods:                           80
Allocatable:
  attachable-volumes-azure-disk:  4
  cpu:                            1900m
  ephemeral-storage:              119716326407
  hugepages-1Gi:                  0
  hugepages-2Mi:                  0
  memory:                         5497572Ki
  pods:                           80

image

Glad, we removed the confusion.

It's one of the "issue", currently the utilization of a node is the some of "pod's utilization", not the node reported utilization, that could included non pod stuff, or pod from a filtered namespaces,...

In the Allocatable column I see 5.20Gi as memory like in your node describe, and it's also the value used to compute percent (I'll recheck).