Code Monkey home page Code Monkey logo

kss's Introduction

KSS - Kubernetes pod status on steroid πŸ’‰

A simple tool to show the current status of a pod and its associated containers and initContainers.

This was developed out of frustration with kubectl get pod not showing much and kubectl describe pod showing way too much in a cryptic way. Debugging failed pods with a lot of initContainers and sideCars usually was done with kubectl get pod -o yaml |less with a lot of going up and down over a pager to figure out what's going on and a bunch of swearing πŸ”ž. All those techniques for introspection and debugging are still useful and KSS is not planning to fully replace them but now thanks to it you can see quickly what happen and what fails and get your sanity back πŸ˜….

Usage

You can specify a pod or multiple ones as argument to KSS, if you don't it will launch the lovely fzf and let you choose the pod interactively, if there is only one pod available it will select it automatically. If you would like to choose multiple pods you can use the key [TAB] and select them, KSS will then show them all.

KSS shows a preview when running with fzf, it will try to do the preview with itself if it cannot find itself in the PATH it will fallback to a good ol' and boring kubectl describe πŸ‘΄πŸΌπŸ‘΅πŸ».

If you add the -l option it will show you the log output of the container, you can adjust how many lines of the log you want to see if you add the flag --maxlines=INT.

You can use the -r option if you would like to restrict it to only some containers, it accepts a regexp as an argument, so you can do some fancy matching in there. You would typically use this flag combined when you are outputting the container's log (-l).

With the -L flag you will display the labels and with the -A flag you will do the same but for annotations.

Install

Packages

Homebrew

You can install KSS latest with homebrew, you just have to fire up those commands in your shell and KSS and its zsh completions will be installed :

brew tap chmouel/kss https://github.com/chmouel/kss
brew install kss

This has been tested as working on linuxbrew too.

Arch

It's available on Arch AUR here.

Install it with your favourite aur installer (i.e: yay)

Manual install

You just make sure you have >=Python3.6, fzf and kubectl. You then can download the script and put it directly into your PATH or checkout this GIT repo and link the binary into your path so you can have do some git pull to get the updates.

With zsh you can install the _kss completionfile to your fpath.

Misc

I may do a krew plugin if this get requested enough. Watch this space as cool people would say πŸ˜ŽπŸ„πŸ€™.

Screenshots

Success run

Success run

Failed run

Fail run

Failed run with logs

Fail run

Restrict the logs output only to a container and only to one line with the -r and --maxlength flags

Restrict to some pod

Selecting a pod with fzf

Select a pod with FZF

Misc

  • The code is getting quite tortured, like some sort of spaghetti plate 🍝 with greasy meatballs πŸ₯© on the top, the kind of stuff you start to write quickly and dirty out of frustration to fix a problem and it grows it grows until it really become an unreadable beast. I probably going to rewrite it up properly with tests and all (in a compiled language perhaps?) soonish enough.

And I actually did start rewritting the whole thing proper, with a bunch of testcases, nice code and all with all the best practices and all. Starting to write my testcases I realise there is so many crazy edge cases and different status in Kubernetes that would have been getting longer than I tought, so let's say for now that KSS has a i in between and we will keep it "KISS" But hey who cares, since it kinda works! (until I broke it :D) πŸ˜…

kss's People

Contributors

chmouel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

kss's Issues

Installation via homebrew

Describe the feature request

Kss should be installable via brew.

Describe alternatives you've considered

I can't really think of any :)

kss should "respect" the user's colors

Is your feature request related to a problem? Please describe.
Currently kss display the name of the container in a hard black colors.
image

Describe the solution you'd like
I would like it to use the user's color (aka here no hard black, just standard background color)

Describe alternatives you've considered
N/A

Additional context
N/A

Installation via Krew

Describe the feature request

Kss should be installable via krew.

Describe alternatives you've considered

brew would also be fine as long as Linuxhombrew is also supported :D

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.