Advertisement
Javi

Kubernetes: delete all namespaces with the prefix "demo-"

Nov 17th, 2021
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.18 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. names=$(kubectl get namespace -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep "demo-")
  4. for each in $names
  5. do
  6. kubectl delete ns $each &
  7. done
  8.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement