Skip to content

Instantly share code, notes, and snippets.

Last active March 9, 2022 03:39
What would you like to do?
Kubectl daily shortcuts
NAMES="$(kubectl api-resources --namespaced --verbs list -o name | grep -v events | tr '\n' ,)"
kubectl get "${NAMES:0:-1}" --show-kind
kubectl patch deployment $1 -p "{\"spec\": {\"template\": {\"metadata\": { \"labels\": { \"redeploy\": \"$(date +%s)\"}}}}}"
kubectl get deploy $1 -o jsonpath="{.spec.replicas}"
kubectl get deploy $1 -o jsonpath="{.spec.template.spec.containers[0].image}"
kubectl get deploy $1 -o jsonpath="{.spec.template.spec.containers[0].resources}"
kubectl patch cronjobs $1 -p "{\"spec\" : {\"suspend\" : true }}"
kubectl run tmp-shell --rm -i --tty --image r0mdau/netshoot -- /bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment