All Projects → yashbhutwala → kubectl-df-pv

yashbhutwala / kubectl-df-pv

Licence: Apache-2.0 license
kubectl plugin - giving admins df (disk free) like utility for persistent volumes

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects
shell
77523 projects

Projects that are alternatives of or similar to kubectl-df-pv

kubectl-janitor
List Kubernetes objects in a problematic state
Stars: ✭ 48 (-81.25%)
Mutual labels:  kubectl, kubectl-plugin, krew-plugin
rbac-tool
Rapid7 | insightCloudSec | Kubernetes RBAC Power Toys - Visualize, Analyze, Generate & Query
Stars: ✭ 546 (+113.28%)
Mutual labels:  kubectl, kubectl-plugin, krew-plugin
kube-lineage
A CLI tool to display all dependencies or dependents of an object in a Kubernetes cluster.
Stars: ✭ 238 (-7.03%)
Mutual labels:  kubectl, kubectl-plugin
kubectl-blame
Show who edited resource fields.
Stars: ✭ 76 (-70.31%)
Mutual labels:  kubectl, kubectl-plugin
kubectl-sql
kubectl-sql is a kubectl plugin that use SQL like language to query the Kubernetes cluster manager
Stars: ✭ 50 (-80.47%)
Mutual labels:  kubectl, kubectl-plugin
kubectlsafe
Safe operations in kubectl with plugin kubectlsafe
Stars: ✭ 36 (-85.94%)
Mutual labels:  kubectl, kubectl-plugin
kubectl-secretdata
A kubectl plugin for viewing decoded Secret data with search flags.
Stars: ✭ 37 (-85.55%)
Mutual labels:  kubectl, kubectl-plugin
kubectl-gopass
Plugin for kubectl to support reading and writing secrets directly from/to gopass
Stars: ✭ 28 (-89.06%)
Mutual labels:  kubectl, kubectl-plugin
KuiClientTemplate
Use this template to make your own custom graphical terminal, via the Kui Grahpical CLI Framework
Stars: ✭ 26 (-89.84%)
Mutual labels:  kubectl, krew-plugin
kubectl-view-webhook
👀 ‼️ This projects aims to visualize critical parts of the admission webhook configuration resource
Stars: ✭ 96 (-62.5%)
Mutual labels:  kubectl, kubectl-plugin
kubectl-plugin-ssh-jump
A kubectl plugin to access nodes or remote services using a SSH jump Pod
Stars: ✭ 117 (-54.3%)
Mutual labels:  kubectl, kubectl-plugin
kubectl-iexec
Kubectl plugin to interactively exec into a pod
Stars: ✭ 102 (-60.16%)
Mutual labels:  kubectl, kubectl-plugin
openebsctl
`openebsctl` is a kubectl plugin to manage OpenEBS storage components.
Stars: ✭ 23 (-91.02%)
Mutual labels:  kubectl, kubectl-plugin
kubectl-gs
kubectl plugin helping with custom resources by Giant Swarm
Stars: ✭ 36 (-85.94%)
Mutual labels:  kubectl, kubectl-plugin
Kubectl Tree
kubectl plugin to browse Kubernetes object hierarchies as a tree 🎄 (star the repo if you are using)
Stars: ✭ 1,962 (+666.41%)
Mutual labels:  kubectl, kubectl-plugin
Ketall
Like `kubectl get all`, but get really all resources
Stars: ✭ 233 (-8.98%)
Mutual labels:  kubectl
kubernetes-101-workshop
Kubernetes 101 workshop for beginners.
Stars: ✭ 17 (-93.36%)
Mutual labels:  kubectl
Helm Kubectl
Docker Hub image with helm and kubectl on top of alpine linux with bash
Stars: ✭ 233 (-8.98%)
Mutual labels:  kubectl
Blackbelt Aks Hackfest
Microsoft Intelligent Cloud Blackbelt Team :: Hackfest Repo
Stars: ✭ 209 (-18.36%)
Mutual labels:  kubectl
kubectl-ctx
Simple kubectl plugin to display/switch contexts
Stars: ✭ 36 (-85.94%)
Mutual labels:  kubectl

kubectl df-pv

A kubectl plugin to see df for persistent volumes.

Requirements

kube-apiserver has api/v1/nodes/ endpoint enabled

Appropriate RBAC. This utility is meant for cluster-admin like user; specifically, you need a service account with enough RBAC privileges to access api/v1/nodes/ from the kube-apiserver.

Using a storage provisioner that populates pv metrics in a compatible manner (see what's been tested below)

Quick Start

Installation

Via Krew

curl https://krew.sh/df-pv | bash
# . ~/.bashrc   # run if you use bash shell
# . ~/.zshrc    # run if you use zsh shell

From source

cd $GOPATH/src/github.com/
mkdir -p yashbhutwala
cd yashbhutwala/
git clone [email protected]:yashbhutwala/kubectl-df-pv.git
cd kubectl-df-pv/
make install
df-pv --help

Via Release Binary

macOS

download_path="./df-pv"
version="v0.2.2"
curl --fail -Lo $download_path "https://github.com/yashbhutwala/kubectl-df-pv/releases/download/${version}/kubectl-df-pv_${version}_darwin_amd64.tar.gz"
chmod +x $download_path
mv $(download_path) /some-dir-in-your-PATH/df-pv

Usage

kubectl df-pv

example output

Flags

> kubectl df-pv --help

df-pv emulates Unix style df for persistent volumes w/ ability to filter by namespace

It autoconverts all "sizes" to IEC values (see: https://en.wikipedia.org/wiki/Binary_prefix and https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-memory)

It colors the values based on "severity" [red: > 75% (too high); yellow: < 25% (too low); green: >= 25 and <= 75 (OK)]

Usage:
  df-pv [flags]

Flags:
  -h, --help               help for df-pv
  -n, --namespace string   if present, the namespace scope for this CLI request (default is all namespaces)
  -v, --verbosity string   log level; one of [info, debug, trace, warn, error, fatal, panic] (default "info")

Other useful commands

enable trace logging, but output to a file

df-pv -v trace 2> trace.log

Tested

Works on

GKE (kubernetes.io/gce-pd dynamic provisioner; both with ssd and standard)

kubeadm configured bare-metal cluster (rook ceph block dynamic provisioner using script)

Does not work due to storage provisioner

kind (rancher/local-path-provisioner dynamic provisioner)

minikube (gcr.io/k8s-minikube/storage-provisioner minikube-hostpath dynamic provisioner)

TODO

[ ] EKS

[ ] AKS

TODO Features

Yet to be completed

☒ sort-by flag

☒ exclude namespaces

☒ only show a specific colored result ("red", "yellow", "green")

Completed

df for all Persistent Volumes in the cluster

human readable output as default (using IEC format)

color based on usage [red: > 75% (too high); yellow: < 25% (too low); green: >= 25 and <= 75 (OK)]

print PV name

print volume mount name

Motivation

Have you ever wondered, "How much free disk space do all my PVs have?" Me too! That's why I built this plugin! I have always just wanted to quick way to see the disk usage of my Persistent Volumes (similar to df or du in Unix). It turns out I'm not the only one, there has been many upstream Kubernetes issues open again and again about this, even some KEPs and PRs. I have compiled some of the issues and KEPs that I've seen in the wild here:

Issues

"this feature is needed .. !!!!" - @halradaideh

"There was a plan to implement this for 1.7 but we ran out of time."

"I need to know to which Pod(s) a PVC is being mounted to, without having to go through each Pod one by one checking the Volume mounts and the PersistentVolumeClaim."

KEPs

"PVC should show how much of the available capacity is used vs available"

"Expose storage metrics to end users"

"Display PVC capacity usage using kubectl"... "Has this been continued somewhere? It would be super useful"

"exposing storage metrics to users"... "Status? Was it done?"

Other relevant/rabbit-hole links

"Volume metrics exposed in /stats/summary not available in /metrics"

interesting metric PR

something similar to du in metrics

client-go issue about kubelet api by @DirectXMan12

kubelet stats api

kubelet client

metrics-server client

blog about kubectl printers and columns

cli-runtime tableprinter usage

kubectl using cli-runtime; sorting is still not implemented

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].