Last active
March 9, 2022 03:39
-
-
Save r0mdau/b1d2b1fdd494e66a9c57960490bb128e to your computer and use it in GitHub Desktop.
Kubectl daily shortcuts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
NAMES="$(kubectl api-resources --namespaced --verbs list -o name | grep -v events | tr '\n' ,)" | |
kubectl get "${NAMES:0:-1}" --show-kind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
kubectl patch deployment $1 -p "{\"spec\": {\"template\": {\"metadata\": { \"labels\": { \"redeploy\": \"$(date +%s)\"}}}}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
kubectl patch cronjobs $1 -p "{\"spec\" : {\"suspend\" : true }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
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