Delete k8s resources in a namespace, based on a prefix

Cristian Glavan
1 min readOct 11, 2020
Photo by CJ Dayrit on Unsplash

If you need to cleanup your namespace resources based on a prefix and don’t want to do it manually, then this script I wrote is for you.

Note that this assumes you use a naming convention for your resources.

This will iterate through resources, in the right order ( as tested so far… ) to delete everything starting with that prefix.

--

--

Cristian Glavan

DevOps Engineer @ Zitec.com — Full-Stack Web Developer — Creative— Martial Artist — Curious — Lateral Thinking