Skip to content

Instantly share code, notes, and snippets.

@kanedafromparis
Created May 14, 2020 13:54
Show Gist options
  • Save kanedafromparis/de91d6c185fb26c717a57a23b5df5fc1 to your computer and use it in GitHub Desktop.
Save kanedafromparis/de91d6c185fb26c717a57a23b5df5fc1 to your computer and use it in GitHub Desktop.
kubectl top pod
kubectl top nodes
kubectl get po -A -o custom-columns=NS:.metadata.namespace,NAME:.metadata.name,NODE:.spec.nodeName,RSRC0:.spec.containers[0].resources.requests.cpu,RSRM0:.spec.containers[0].resources.requests.memory,RSRL0:.spec.containers[0].resources.limits.cpu,RSLM0:.spec.containers[0].resources.limits.memory
kubectl get po -A --field-selector spec.nodeName=worker512
kubectl get po -A --field-selector spec.nodeName=worker512 custom-columns=NS:.metadata.namespace,NAME:.metadata.name,NODE:.spec.nodeName,RSRC0:.spec.containers[0].resources.requests.cpu,RSRM0:.spec.containers[0].resources.requests.memory,RSRL0:.spec.containers[0].resources.limits.cpu,RSLM0:.spec.containers[0].resources.limits.memory --no-headers | while read ns po nd RSRC0 RSRM0 RSLC0 RSLM0 ; do kubectl label -n $ns po $po peek-top=20191222; done
kubectl top pod -A -l peek-top=20191222
kubectl get pod -A -l peek-top=20191222 -o custom-columns=NS:.metadata.namespace,NAME:.metadata.name --no-headers | while read ns po ; do kubectl label -n $ns po $po peek-top- ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment