Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/soraro/kurt
A Kubernetes plugin that gives context to what is restarting in your Kubernetes cluster
https://github.com/soraro/kurt
golang kubectl-plugins kubernetes
Last synced: about 1 month ago
JSON representation
A Kubernetes plugin that gives context to what is restarting in your Kubernetes cluster
- Host: GitHub
- URL: https://github.com/soraro/kurt
- Owner: soraro
- License: mit
- Created: 2021-10-04T19:23:28.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-22T12:16:40.000Z (5 months ago)
- Last Synced: 2024-08-02T01:22:20.402Z (4 months ago)
- Topics: golang, kubectl-plugins, kubernetes
- Language: Go
- Homepage: https://github.com/soraro/kurt
- Size: 167 KB
- Stars: 142
- Watchers: 7
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-repositories - soraro/kurt - A Kubernetes plugin that gives context to what is restarting in your Kubernetes cluster (Go)
README
# kurt
```
kurt: KUbernetes Restart TrackerA restart tracker that gives context to what is restarting in your cluster
Usage:
kurt [command]Available Commands:
all Print all groupings collected by kurt!
completion generate the autocompletion script for the specified shell
help Help about any command
labels Only print restart counts grouped by labels
namespaces Only print namespace-wide restart counts
nodes Only print node restart counts
pods Only print pod restart counts
version Print the current version and exitFlags:
-h, --help help for kurt
-l, --label strings Specify multiple times for the label keys you want to see.
For example: "kurt all -l app"
-c, --limit int Limit the number of resources you want to see. Set limit to 0 for no limits. Must be positive.
For example: "kurt all -c=10" (default 5)
-n, --namespace strings Specify namespace for kurt to collect restart metrics.
Leave blank to collect in all namespaces.
-o, --output string Specify output type. Options are: json, yaml, standard
For example: "kurt all -o json" (default "standard")Use "kurt [command] --help" for more information about a command.
```# Install
Head over to our [releases page](https://github.com/soraro/kurt/releases/latest) or run as a `kubectl` plugin with [krew](https://krew.sigs.k8s.io/)
```
kubectl krew install kurt
```Easily install krew and kurt with the following:
```
curl https://krew.sh/kurt | bash
```# Examples
Show the top 5 highest restart counts grouped by `Namespace`, `Node`, `Label`, and `Pod`:
```
$ kurt allkurt: KUbernetes Restart Tracker
==========
Namespace Restarts
default 2
test 1
kube-system 0==========
Node Restarts
minikube-m02 2
minikube-m03 1
minikube 0==========
Label Restarts
run:nginx 3
component:etcd 0
k8s-app:kube-proxy 0
addonmanager.kubernetes.io/mode:Reconcile 0
integration-test:storage-provisioner 0==========
Pod Namespace Restarts
nginx default 2
nginx test 1
kube-apiserver-minikube kube-system 0
storage-provisioner kube-system 0
etcd-minikube kube-system 0
```Show more results:
```
kurt all -c 10# use -c 0 if you want to show all results
```Show which node has the most restarted pods:
```
kurt no
```Show top 20 pod restart counts in the `default` namespace which also have the `app` label key:
```
kurt po -n default -l app -c 20
```Get help:
```
kurt -h
```Structured output:
```
# With structured output you could use a script like this to delete the top rebooting podJSON=$(kurt pods -o json)
POD=$(echo $JSON | jq -r .pods[0].name)
NS=$(echo $JSON | jq -r .pods[0].namespace)
kubectl delete pod $POD -n $NS
```# Permissions
As seen in the [`cmd/collect.go` file](https://github.com/soraro/kurt/blob/main/cmd/collect.go) the only permission required for kurt is `pods/list`.# Requirements
Go Version 1.21# Building
```
go build .
```
Outputs a `kurt` binary# Testing
```
go test ./cmd -v
```