Skip to content

Instantly share code, notes, and snippets.

@deevis
Created February 22, 2021 18:10
Show Gist options
  • Save deevis/a8617e68903ca063ce94dec9c7557d41 to your computer and use it in GitHub Desktop.
Save deevis/a8617e68903ca063ce94dec9c7557d41 to your computer and use it in GitHub Desktop.
Delete Kubectl namespaces in my project older than 40d ( but not > 99)
for ns in `kubectl get pods -A | grep my_project_name | grep "^.*[4-9]\dd$" | awk {'print $1'} | uniq`;do kubectl delete namespace $ns --namespace $ns; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment