• Stars
    star
    526
  • Rank 84,247 (Top 2 %)
  • Language
    Rust
  • License
    Creative Commons ...
  • Created about 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

kubectl-view-allocations

Crates.io Crates.io

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. Actions Status Documentation

Crates.io GitHub All Releases

kubectl plugin lists allocations for resources (cpu, memory, gpu,...) as defined into the manifest of nodes and running pods. It doesn't list usage like kubectl top. It can provide result grouped by namespaces, nodes, pods and filtered by resources'name.

Columns displayed :

  • Requested : Quantity of resources requested by the container in the pod's manifest. It's the sum group by pod, namespace, node where container is running. With percentage of resources requested over what is allocatable in the group.
  • Limit : Quantity of resources max (limit) requestable by the container in the pod's manifest. It's the sum group by pod, namespace, node where container is running. With percentage of resources max / limit over what is allocatable in the group.
  • Allocatable : Allocatable resources defined (or detected) on nodes.
  • Free : Allocatable - max (Limit, Requested)
  • Utilization : Quantity of resources (cpu & memory only) used as reported by Metrics API. It's disable by default, metrics-server is optional and should be setup into the cluster.

Install

Via download binary

Download from github's release or use script

curl https://raw.githubusercontent.com/davidB/kubectl-view-allocations/master/scripts/getLatest.sh | bash

Via krew (kubectl plugin manager)

Krew – kubectl plugin manager

kubectl krew install view-allocations

Via cargo

cargo install kubectl-view-allocations

As lib in Cargo.toml

If you want to embed some function or struct of the plugin into an other rust code:

[dependencies]
kubectl-view-allocations = { version = "0.14", default-features = false }

[features]
default = ["k8s-openapi/v1_20"]

Usage

Show help

> kubectl-view-allocations -h

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

Usage: kubectl-view-allocations [OPTIONS]

Options:
      --context <CONTEXT>              The name of the kubeconfig context to use
  -n, --namespace <NAMESPACE>          Show only pods from this namespace
  -u, --utilization                    Force to retrieve utilization (for cpu and memory), require to have metrics-server https://github.com/kubernetes-sigs/metrics-server
  -z, --show-zero                      Show lines with zero requested and zero limit and zero allocatable
  -r, --resource-name <RESOURCE_NAME>  Filter resources shown by name(s), by default all resources are listed
  -g, --group-by <GROUP_BY>            Group information hierarchically (default: -g resource -g node -g pod) [possible values: resource, node, pod, namespace]
  -o, --output <OUTPUT>                Output format [default: table] [possible values: table, csv]
  -h, --help                           Print help
  -V, --version                        Print version

https://github.com/davidB/kubectl-view-allocations

Show gpu allocation

> kubectl-view-allocations -r gpu

 Resource                   Requested       Limit  Allocatable  Free
  nvidia.com/gpu           (71%) 10.0  (71%) 10.0         14.0   4.0
  ├─ node-gpu1               (0%)  __    (0%)  __          2.0   2.0
  ├─ node-gpu2               (0%)  __    (0%)  __          2.0   2.0
  ├─ node-gpu3             (100%) 2.0  (100%) 2.0          2.0    __
  │  └─ fah-gpu-cpu-d29sc         2.0         2.0           __    __
  ├─ node-gpu4             (100%) 2.0  (100%) 2.0          2.0    __
  │  └─ fah-gpu-cpu-hkg59         2.0         2.0           __    __
  ├─ node-gpu5             (100%) 2.0  (100%) 2.0          2.0    __
  │  └─ fah-gpu-cpu-nw9fc         2.0         2.0           __    __
  ├─ node-gpu6             (100%) 2.0  (100%) 2.0          2.0    __
  │  └─ fah-gpu-cpu-gtwsf         2.0         2.0           __    __
  └─ node-gpu7             (100%) 2.0  (100%) 2.0          2.0    __
     └─ fah-gpu-cpu-x7zfb         2.0         2.0           __    __

Overview only

> kubectl-view-allocations -g resource

 Resource              Requested          Limit  Allocatable     Free
  cpu                 (21%) 56.7    (65%) 176.1        272.0     95.9
  ephemeral-storage     (0%)  __       (0%)  __        38.4T    38.4T
  memory             (8%) 52.7Gi  (15%) 101.3Gi      675.6Gi  574.3Gi
  nvidia.com/gpu      (71%) 10.0     (71%) 10.0         14.0      4.0
  pods                (9%) 147.0     (9%) 147.0         1.6k     1.5k

Show utilization

  • Utilization information are retrieve from metrics-server (should be setup on your cluster).
  • Only report cpu and memory utilization
> kubectl-view-allocations -u

 Resource                                        Utilization     Requested         Limit  Allocatable   Free 
  cpu                                              (0%) 9.0m  (10%) 200.0m            __          2.0    1.8 
  └─ lima-rancher-desktop                          (0%) 9.0m  (10%) 200.0m            __          2.0    1.8 
     ├─ coredns-96cc4f57d-57cj9                         1.0m        100.0m            __           __     __ 
     ├─ local-path-provisioner-84bb864455-czzcg         1.0m            __            __           __     __ 
     ├─ metrics-server-ff9dbcb6c-kb7x9                  4.0m        100.0m            __           __     __ 
     ├─ svclb-traefik-ggd2q                             2.0m            __            __           __     __ 
     └─ traefik-55fdc6d984-sqp57                        1.0m            __            __           __     __ 
  ephemeral-storage                                       __            __            __        99.8G     __ 
  └─ lima-rancher-desktop                                 __            __            __        99.8G     __ 
  memory                                         (1%) 51.0Mi  (2%) 140.0Mi  (3%) 170.0Mi        5.8Gi  5.6Gi 
  └─ lima-rancher-desktop                        (1%) 51.0Mi  (2%) 140.0Mi  (3%) 170.0Mi        5.8Gi  5.6Gi 
     ├─ coredns-96cc4f57d-57cj9                       11.5Mi        70.0Mi       170.0Mi           __     __ 
     ├─ local-path-provisioner-84bb864455-czzcg        6.2Mi            __            __           __     __ 
     ├─ metrics-server-ff9dbcb6c-kb7x9                14.9Mi        70.0Mi            __           __     __ 
     ├─ svclb-traefik-ggd2q                          548.0Ki            __            __           __     __ 
     └─ traefik-55fdc6d984-sqp57                      17.9Mi            __            __           __     __ 
  pods                                                    __      (5%) 5.0      (5%) 5.0        110.0  105.0 
  └─ lima-rancher-desktop                                 __      (5%) 5.0      (5%) 5.0        110.0  105.0

Group by namespaces

> kubectl-view-allocations -g namespace

 Resource               Requested         Limit  Allocatable   Free 
  cpu                (10%) 200.0m            __          2.0    1.8 
  └─ kube-system           200.0m            __           __     __ 
  ephemeral-storage            __            __        99.8G     __ 
  memory             (2%) 140.0Mi  (3%) 170.0Mi        5.8Gi  5.6Gi 
  └─ kube-system          140.0Mi       170.0Mi           __     __ 
  pods                   (5%) 5.0      (5%) 5.0        110.0  105.0 
  └─ kube-system              5.0           5.0           __     __ 

Show as csv

In this case value as expanded as float (with 2 decimal)

kubectl-view-allocations -o csv
Date,Kind,resource,node,pod,Requested,%Requested,Limit,%Limit,Allocatable,Free
2020-08-19T19:12:48.326605746+00:00,resource,cpu,,,59.94,22%,106.10,39%,272.00,165.90
2020-08-19T19:12:48.326605746+00:00,node,cpu,node-gpu1,,2.31,19%,4.47,37%,12.00,7.53
2020-08-19T19:12:48.326605746+00:00,pod,cpu,node-gpu1,yyy-b8bd56fbd-5x8vq,1.00,,2.00,,,
2020-08-19T19:12:48.326605746+00:00,pod,cpu,node-gpu1,kube-flannel-ds-amd64-7dz9z,0.10,,0.10,,,
2020-08-19T19:12:48.326605746+00:00,pod,cpu,node-gpu1,node-exporter-gpu-b4w7s,0.11,,0.22,,,
2020-08-19T19:12:48.326605746+00:00,pod,cpu,node-gpu1,xxx-backend-7d84544458-46qnh,1.00,,2.00,,,
2020-08-19T19:12:48.326605746+00:00,pod,cpu,node-gpu1,weave-scope-agent-bbdnz,0.10,,0.15,,,
2020-08-19T19:12:48.326605746+00:00,node,cpu,node-gpu2,,0.31,1%,0.47,2%,24.00,23.53
2020-08-19T19:12:48.326605746+00:00,pod,cpu,node-gpu2,kube-flannel-ds-amd64-b5b4v,0.10,,0.10,,,
2020-08-19T19:12:48.326605746+00:00,pod,cpu,node-gpu2,node-exporter-gpu-796jz,0.11,,0.22,,,
2020-08-19T19:12:48.326605746+00:00,pod,cpu,node-gpu2,weave-scope-agent-8rhnd,0.10,,0.15,,,
2020-08-19T19:12:48.326605746+00:00,node,cpu,node-gpu3,,3.41,11%,6.67,21%,32.00,25.33
...

It can be combined with "group-by" options.

kubectl-view-allocations -g resource -o csv
Date,Kind,resource,Requested,%Requested,Limit,%Limit,Allocatable,Free
2020-08-19T19:11:49.630864028+00:00,resource,cpu,59.94,22%,106.10,39%,272.00,165.90
2020-08-19T19:11:49.630864028+00:00,resource,ephemeral-storage,0.00,0%,0.00,0%,34462898618662.00,34462898618662.00
2020-08-19T19:11:49.630864028+00:00,resource,hugepages-1Gi,0.00,,0.00,,,
2020-08-19T19:11:49.630864028+00:00,resource,hugepages-2Mi,0.00,,0.00,,,
2020-08-19T19:11:49.630864028+00:00,resource,memory,69063409664.00,10%,224684670976.00,31%,722318667776.00,497633996800.00
2020-08-19T19:11:49.630864028+00:00,resource,nvidia.com/gpu,3.00,27%,3.00,27%,11.00,8.00
2020-08-19T19:11:49.630864028+00:00,resource,pods,0.00,0%,0.00,0%,1540.00,1540.00

Alternatives & Similars

More Repositories

1

scala-maven-plugin

The scala-maven-plugin (previously maven-scala-plugin) is used for compiling/testing/running/documenting scala code in maven.
Java
554
star
2

metrics-influxdb

A reporter for metrics which announces measurements to an InfluxDB server.
Java
270
star
3

yuicompressor-maven-plugin

maven's plugin to compress (Minify / Ofuscate / Aggregate) Javascript files and CSS files using YUI Compressor
JavaScript
121
star
4

scala-archetype-simple

a simple maven archetype for project in scala
Scala
109
star
5

tracing-opentelemetry-instrumentation-sdk

Middlewares and tools to integrate axum + tracing + opentelemetry
Rust
73
star
6

rust-cargo-make

🛠️ GitHub Action to install `cargo-make` command
TypeScript
28
star
7

livereload-jvm

A micro http-server compatible with LiveReload 2 (protocol). Should be used at compile/build-time.
JavaScript
23
star
8

sandbox_axum_observability

Sandbox to experiment axum and observability
Rust
23
star
9

vscaladoc

A variation of scaladoc : an API generator for project written in Scala
Scala
22
star
10

handlebars_misc_helpers

A collection of helpers for handlebars (rust) to manage string, json, yaml, toml, path, file, http request.
Rust
21
star
11

git2_credentials

Provide credentials function to used with git2::RemoteCallbacks.credentials
Rust
19
star
12

gradle-getdown-plugin

A gradle plugin to bundle java app + jre with getdown support
Groovy
16
star
13

scalacs

[experimental] http server to run tools like compilation (target to replace fsc+fsc-server)
Scala
10
star
14

sandbox_bazel

explorations of bazel, support for a serie of articles and to experiment stuff on bazel.
Starlark
9
star
15

winstone-maven-plugin

Embed your warfile into/with the winstone JAR itself. This allows an all-in-one container plus web-application JAR file to be downloaded, and then unpacked at execution time.
8
star
16

vscaladoc2_www

website to display json api generated by vscaladoc2_genjson
JavaScript
6
star
17

jme3_ext_deferred

[experimental] a deferred rendering for jME3
Xtend
6
star
18

ld47_keep_inside

My game for Ludum Dare 47
Rust
6
star
19

git-find

A tool (cli & lib) to find local git repositories.
Rust
5
star
20

jme3_ext_spatial_explorer

A debug tool for jmonkeyengine : display a window to browse the content of node (root of the scene by default).
Java
5
star
21

dgraph_client-rs

A rust client for dgraph.
Rust
5
star
22

dartemis_toolbox

A set of addons (Component, System, helper, ...) to use with dartemis
Dart
5
star
23

applet-maven-plugin

maven's plugin to generate jnlp, html, js, to merge jars, to sign, to pack200 jar (with support for nativelib, proguard,...)
Java
5
star
24

scala-tools-parent

shared description pom for maven project under groupId org.scala-tools
4
star
25

jme3_skel

my project skeleton for jme 3.0 projects (gradle based)
Java
4
star
26

spoon-maven-plugin

A maven plugin to use spoonlet(s) in a maven 2 build. Spoonlets (and dependencies) are downloaded if needed.
Java
4
star
27

run_on_jvm

A tool to run jvm script (java, scala, ...) with dependencies
Java
3
star
28

forum-migration

Scripts for the great forum migration..
Ruby
3
star
29

vscaladoc2_demoprj

Sample project use to test vscaladoc2
Scala
2
star
30

reabuilder

experiment : a generic fs reactive/continuous builder
Scala
2
star
31

net.alchim31.eclipse.console

eclipse console addons
Java
2
star
32

yascaladt-doc

Documentation about YaScalaDT
2
star
33

rtmidi-jvm

A wrapper/adapter for RtMidi
C++
2
star
34

plob

[experimental] PipeLine Of Builders : an event driven / reactive build tool
Scala
1
star
35

davidB

1
star
36

glf

a webgl wrapper in dart
Dart
1
star
37

davidb.github.com

my site
1
star
38

jme3_lib2repo

install jme3 (jmonkeyengine 3.0) into local maven repository
Groovy
1
star
39

vdrones

[experimental] my first dart application/game
Dart
1
star
40

org.scala-ide.qa

place to store integration tests, sample projects for scalaIDE (eclipse plugin)
Java
1
star
41

xhat

[experimental] p2p chat build with rust + libp2p + flutter
1
star
42

labs_cooking_microservices_with_rust

laboratory for using Rust in microservices environment
Rust
1
star
43

yascaladt

Yet Another Scala Plugin for Eclipse
Java
1
star
44

scala_sugar_in_java

Source code my blog series "Scala sugar in Java"
Java
1
star
45

html_toolbox

A toolbox for commons operations on html (for dartlang).
Dart
1
star
46

nvim

My NeoVim configuration files
Vim Script
1
star
47

logo

source of the Logo
1
star
48

pseudobench_graphql

My pseudo benchmark/comparaison between graphQL impl
Go
1
star
49

vscaladoc2_genjson

VScaladoc2 Json Generator : generate api from scala source in json format
Scala
1
star
50

alchim31-maven-parent

parent pom for alchim31 maven's plugin
1
star
51

shader_editor

[wip] a shader editor (glsl vert + frag)
CSS
1
star
52

prj-scala-only

a demo project used as archetype/basic project with sample of test
Scala
1
star
53

.vim

my vim configuration directory
Vim Script
1
star
54

templates

repository to host my collections of templates to used with https://github.com/ffizer/ffizer.
HTML
1
star