dotfiles/bin/kp

17 lines
343 B
Plaintext
Raw Normal View History

2021-01-17 07:31:07 +00:00
#!/bin/sh
POD=$(sudo kubectl get pod | grep -P "^$2" | awk '{print $1}')
CTN=$3
case $1 in
sh)
2021-01-17 16:29:27 +00:00
kubectl exec -it $POD ${CTN:+"-c $CTN"} -- /bin/sh
2021-01-17 07:31:07 +00:00
;;
d) # describe pod
kubectl describe pod $POD
;;
e) # watch event of pod
kubectl get event -w --field-selector=involvedObject.name=$POD
esac