Giter Site home page Giter Site logo

knsk's Introduction

knsk - Kubernetes namespace killer

This script is aimed to kill namespaces that are stuck in Terminating mode after you try to delete them. Just calling this script without flags, it shows you the possible problems that put your namespace in forever terminating mode.

It automates the tips by https://github.com/alvaroaleman in kubernetes/kubernetes#60807 (comment)

If it doesn't work for you, please, let me know. It is hard to force namespace in Terminating mode just to test it.

Do you want a backup first?

Just call the script to make a backup of all cluster in YAML format, ordered by folder:

 curl -s https://raw.githubusercontent.com/thyarles/knsk/master/backup-yaml.sh | bash 
 wget -q https://raw.githubusercontent.com/thyarles/knsk/master/backup-yaml.sh -O - | bash 

Basic usage

 curl -s https://raw.githubusercontent.com/thyarles/knsk/master/knsk.sh | bash 
 wget -q https://raw.githubusercontent.com/thyarles/knsk/master/knsk.sh -O - | bash 

In this mode, this script only shows the possible causes that put your namespaces in Terminating mode. If you want this script to try to fix the mess, clone this repository, set the execution bit to the knsk.sh script doing chmod +x knsk.sh and look at advanced options by typing ./knsk.sh --help.

Just to see what are the possible commands to solve the problem by yourself, use the dry-run mode like

 ./knsk.sh --dry-run --delete-all --force

Options

knsk.sh [options]

--dry-run             Show what will be executed instead of execute it (use with '--delete-*' options)
--skip-tls            Set --insecure-skip-tls-verify on kubectl call
--delete-api          Delete broken API found in your Kubernetes cluster
--delete-resource     Delete resources found in your stuck namespaces
--delete-all          Delete resources of stuck namespaces and broken API
--force               Force deletion of stuck namespaces even if a clean deletion fail
--port {number}       Up kubectl proxy on this port, default is 8765
--timeout {number}    Max time (in seconds) to wait for Kubectl commands
--no-color            All output without colors (useful for scripts)
-h --help             Show this help

Issues

If knsk doesn't meet your needs, feel free to open an issue, I'll be happy to help.

Also, you can try the new nsmurder. I've never used it and as far as I know it was made in Go. If you are serious about security, you should carefully examine the source code, including (source code of dependencies) before using it. I believe in the developer who made it, he's a nice guy, but I don't believe in the developers of the dependencies the project needs.

Atention

As Kubernetes progressed and those problems we used to have on versions before 1.20 doesn't exist anymore, this repository will be archived soon. Thanks you all that helped make the OPS life a little better making this code reliable and saving us tons of time.

knsk's People

Contributors

achetronic avatar ekeih avatar hd-deman avatar kevin-yen avatar mwei0210 avatar nneram avatar raitobezarius avatar robinbraemer avatar saadlu avatar sahil-lakhwani avatar thyarles avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.