Skip to content

Instantly share code, notes, and snippets.

@arvind-iyer
Created January 30, 2026 06:18
Show Gist options
  • Select an option

  • Save arvind-iyer/fffb3a4f38095236f6f770fc353616b0 to your computer and use it in GitHub Desktop.

Select an option

Save arvind-iyer/fffb3a4f38095236f6f770fc353616b0 to your computer and use it in GitHub Desktop.
kube shortcuts
function kdesc ()
{
local cmd_args="${@:1:$#-1}"
local pod_prefix="${!#}"
local item_name=$(kubectl get $cmd_args | grep -P "^$pod_prefix"| awk '{ print $1 }')
kubectl describe $cmd_args $item_name
}
function klog ()
{
local cmd_args="${@:1:$#-1}"
local pod_prefix="${!#}"
local item_name=$(kubectl get pod $cmd_args | grep -P "^$pod_prefix" | head -1 | awk '{ print $1 }')
kubectl logs -f --tail 200 $cmd_args $item_name
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment