Code Monkey home page Code Monkey logo

kubectl-free's Introduction

kubectl free

Build Status Maintainability Go Report Card codecov kubectl plugin MIT License

Print pod resources/limits usage on Kubernetes node(s) like a linux "free" command.

$ kubectl free
NAME    STATUS   CPU/use   CPU/req   CPU/lim   CPU/alloc   CPU/use%   CPU/req%   CPU/lim%   MEM/use    MEM/req    MEM/lim    MEM/alloc   MEM/use%   MEM/req%   MEM/lim%
node1   Ready    58m       704m      304m      3600m       1%         19%        8%         2144333K   807403K    375390K    5943857K    36%        13%        6%
node2   Ready    235m      350m      2100m     3600m       6%         9%         58%        2061467K   260046K    1304428K   5943857K    34%        4%         21%
node3   Ready    222m      2030m     12900m    3600m       6%         56%        358%       2935312K   3736783K   8347396K   5943865K    49%        62%        140%

And list containers of pod on Kubernetes node(s).

$ kubectl free --list node1 --all-namespaces
NODE NAME  NAMESPACE     POD NAME                               POD AGE   POD IP       POD STATUS   CONTAINER            CPU/use   CPU/req   CPU/lim   MEM/use   MEM/req   MEM/lim
node1      default       nginx-7cdbd8cdc9-q2bbg                 3d22h     10.112.2.43  Running      nginx                2m        100m      2         27455K    134217K   1073741K
node1      kube-system   coredns-69dc677c56-chfcm               9d        10.112.3.2   Running      coredns              3m        100m      -         17420K    73400K    178257K
node1      kube-system   kube-flannel-ds-amd64-4b4s2            9d        10.1.2.3     Running      kube-flannel         4m        100m      100m      13877K    52428K    52428K
node1      kube-system   kube-state-metrics-69bcc79474-wvmmk    9d        10.112.3.3   Running      kube-state-metrics   11m       104m      104m      33382K    113246K   113246K
node1      kube-system   kube-state-metrics-69bcc79474-wvmmk    9d        10.112.3.3   Running      addon-resizer        1m        100m      100m      8511K     31457K    31457K
...

Install

kubectl-free binary is available at release page or you can make binary.

$ make
$ mv _output/kubectl-free /usr/local/bin/.
# Happy free time!
$ kubectl free

Usage

# Show pod resource usage of Kubernetes nodes (default namespace is "default").
kubectl free

# Show pod resource usage of Kubernetes nodes (all namespaces).
kubectl free --all-namespaces

# Show pod resource usage of Kubernetes nodes with number of pods and containers.
kubectl free --pod

# Using label selector.
kubectl free -l key=value

# Print raw(bytes) usage.
kubectl free --bytes --without-unit

# Using binary prefix unit (GiB, MiB, etc)
kubectl free -g -B

# List resources of containers in pods on nodes.
kubectl free --list

# List resources of containers in pods on nodes with image information.
kubectl free --list --list-image

# Print container even if that has no resources/limits.
kubectl free --list --list-all

# Do you like emoji? ๐Ÿ˜ƒ
kubectl free --emoji
kubectl free --list --emoji

Notice

This plugin shows just sum of requested(limited) resources, not a real usage.
I recommend to use kubectl free with kubectl top.

kubectl free v0.2.0 supports printing real usages from metrics server in a target cluster.
You can disable printing usage with --no-metrics option.

License

This software is released under the MIT License.

kubectl-free's People

Contributors

makocchi-git avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

lemaral kom0055

kubectl-free's Issues

Distribute via krew?

๐Ÿ‘‹ Hello, maintainer of the kubectl plugin manager krew here.

What do you think about making your plugin available via krew? You would benefit from

  • Greater visibility due krew's large user basis.
  • Easier installs.
  • Seamless upgrades for new plugin versions.

Krew already has over 60 plugins and more are coming in. See our development guide if you're interested. Please also consult our naming guide to see if your plugin already fulfills our naming requirements.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.