initial checkin

This commit is contained in:
Radar231 2021-12-08 11:19:07 -05:00
commit 30253f1e40
2 changed files with 16 additions and 0 deletions

6
README.md Normal file
View File

@ -0,0 +1,6 @@
# k8s_cleanup-replicasets repo
## Introduction
This is a simple script to clean up orphaned replicaset objects.

10
clean-k8s-rs.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
nslist="default delfax guacamole home-automation homer k8stv nagios navidrome pihole tiddlywiki"
for i in $nslist
do
echo "Cleaning up orphaned replicasets in namespace ${i}."
kubectl -n $i delete rs $(kubectl -n $i get rs | awk '{if ($2 + $3 + $4 == 0) print $1}' | grep -v 'NAME') 2>/dev/null
done