Thanks to visit codestin.com
Credit goes to github.com

Skip to content

CPU Limit percentage in pod view counts containers without limits plus limited containers #881

@jsoref

Description

@jsoref

Describe the bug
We have a pod with two containers
argocd-application-controller (no cpu limit)
linkerd-proxy (10m cpu limit)

To Reproduce

  1. pods view
  2. see a red percentage limit thing ...
    ┌────────────────────────────────────────────────────────────────── Pods(argocd)[18] ──────────────────────────────────────────────────────────────────┐
    │ NAME                                            READY RESTARTS STATUS   CPU MEM %CPU/R %MEM/R %CPU/L %MEM/L IP          NODE                         │
    │ argocd-application-controller-5f48755598-vclkf  2/2          0 Running   41 136     13     26    409      6 10.52.2.16  gke-default-cluster-default… │
    
  3. See percentage that looks scary
  4. highlight row
  5. press enter
  6. scroll right to see cpu/l
    ┌──────────────────────────────────────── Containers(argocd/argocd-application-controller-5f48755598-vclkf)[3] ────────────────────────────────────────┐
    │ READY  STATE       INIT     RESTARTS PROBES(L:R)   CPU  MEM  %CPU/R  %MEM/R   %CPU/L   %MEM/L PORTS                                    AGE           │
    │ true   Running     false           0 on:on          40  120      13      24        0        5 controller:8082                          5h46m         │
    │ true   Completed   true            0 off:off       n/a  n/a     n/a     n/a      n/a      n/a                                          5h46m         │
    │ true   Running     false           0 on:on           2   15      40      75       20       37 linkerd-proxy:4143,linkerd-admin:4191    5h46m         │
    
  7. For perspective, check the output from kubectl:
    $ kubectl -n argocd top pod argocd-application-controller-5f48755598-vclkf
    NAME                                             CPU(cores)   MEMORY(bytes)
    argocd-application-controller-5f48755598-vclkf   112m         136Mi
    $ kubectl -n argocd get pod argocd-application-controller-5f48755598-vclkf -o json|jq -r -M '{unlimited_name: .spec.containers[0].name, unlimited_res:.spec.containers[0].resources, limited_name: .spec.containers[1].name, limited_res:.spec.containers[1].resources}'
    {
      "unlimited_name": "application-controller",
      "unlimited_res": {
        "limits": {
          "memory": "2Gi"
        },
        "requests": {
          "cpu": "300m",
          "memory": "500Mi"
        }
      },
      "limited_name": "linkerd-proxy",
      "limited_res": {
        "limits": {
          "cpu": "10m",
          "memory": "40Mi"
        },
        "requests": {
          "cpu": "5m",
          "memory": "20Mi"
        }
      }
    }

Expected behavior
Containers which have no limit (as this one does) should be treated as n/a, and skipped while summing numerators and denominators.

Screenshots

Versions (please complete the following information):

  • OS: Mac OS 10.14.6
  • K9s: 0.20.3
  • K8s: v1.16.13-gke.401

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions