Skip to content

Instantly share code, notes, and snippets.

@Gibby
Last active February 1, 2022 16:19
Show Gist options
  • Save Gibby/9d3faf609e0d66e8b79f3ac13a64e4f3 to your computer and use it in GitHub Desktop.
Save Gibby/9d3faf609e0d66e8b79f3ac13a64e4f3 to your computer and use it in GitHub Desktop.
Force kubernetes namespace - Use for when namespace stuck in terminating
#!/bin/bash
NAMESPACE="foo" \
kubectl get namespace "$NAMESPACE" -o json | tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" | kubectl replace --raw /api/v1/namespaces/"$NAMESPACE"/finalize -f -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment