From d081f1b38380b2d9cdd6581188c2d4306ba877a1 Mon Sep 17 00:00:00 2001 From: Daniel Carrillo Date: Wed, 23 Oct 2024 11:53:44 +0200 Subject: [PATCH] [.zshrc] Add knodes function --- .zshrc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.zshrc b/.zshrc index 529cc3f..bdbd854 100644 --- a/.zshrc +++ b/.zshrc @@ -88,6 +88,18 @@ kexec () { [ -n "$cid" ] && kubectl exec -ti "$cid" -- "${cmd[@]}" } +knodes () { + kubectl get node -o json \ + | jq -r '.items[] | { + name:.metadata.name, + type:.metadata.labels."beta.kubernetes.io/instance-type", + karpenter:.metadata.labels."karpenter.sh/nodepool", + capacity:.metadata.labels."karpenter.sh/capacity-type", + registered:.metadata.labels."karpenter.sh/registered", + initialized:.metadata.labels."karpenter.sh/initialized", + } | [.name,.type,.karpenter,.capacity,.registered,.initialized] | @tsv' +} + siteinfo () { local url=$(echo "$1" | sed 's#^https\?://##') local ip="$(dig +short "$url" | tail -1)"