Skip to content

Instantly share code, notes, and snippets.

@lomkju
Last active December 26, 2018 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lomkju/5976866b7df22170d0c9ea8fa8534d39 to your computer and use it in GitHub Desktop.
Save lomkju/5976866b7df22170d0c9ea8fa8534d39 to your computer and use it in GitHub Desktop.
#DUMP yamls
kubectl get deploy | awk 'NR>1{ print $1 }' | xargs -I{} sh -c 'kubectl get deploy/$1 --export -o yaml > $1.yml' -- {}
#Rollout undo
kubectl get deploy | awk 'NR>1{ print $1 }' | xargs -I{} sh -c 'kubectl rollout undo deploy/$1' -- {}
#Delete all everything in a namespace
kubectl delete --all services,deployments,pods,ingress,secrets,configmaps
#Delete specific services
kubectl delete services $(kubectl get services | grep test | awk '{print $1}')
kubectl --kubeconfig=mondelez-development --namespace=staging delete pods $(kubectl --kubeconfig=mondelez-development --namespace=staging get pods -o=custom-columns=NAME:.metadata.name | grep mondelezrasa | awk '{print $1}')
#Run Local
kubectl run NAME -it --image=IMAGE --overrides='{ "apiVersion": "v1", "metadata": { "annotations" : { "iam.amazonaws.com/role": "IAM" } }, "spec": { "imagePullSecrets": [{"name": "registry"}] } }' --restart=Never --command -- /bin/sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment