Skip to content

Commit

Permalink
Add README
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed Aug 19, 2024
1 parent 695923d commit 31c1515
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
kubetrim
====================================================

Tidy up any old or broken Kubernetes clusters and contexts from your kubeconfig.

kubetrim tries to connect to each cluster in the current kubeconfig file, and removes any that are unreachable, or which error.

## Usage

```bash
$ kubectx

default
do-lon1-openfaas-cluster
kind-2
kind-ingress

$ kubetrim

kubetrim (dev) by Alex Ellis

Loaded: /home/alex/.kube/config. Checking..
- kind-2: ✅
- kind-ingress: ❌ - (failed to connect to cluster: Get "https://127.0.0.1:40349/api/v1/nodes": dial tcp 127.0.0.1:40349: connect: connection refused)
- default: ✅
- do-lon1-openfaas-cluster: ❌ - (failed to connect to cluster: Get "https://da39a3ee5e6b4b0d3255bfef95601890afd80709.k8s.ondigitalocean.co.uk/api/v1/nodes": dial tcp: lookup da39a3ee5e6b4b0d3255bfef95601890afd80709.k8s.ondigitalocean.co.uk on 127.0.0.53:53: no such host)
Updated: /home/alex/.kube/config (in 364ms).

$ kubectx

default
kind-2
```

Try out kubetrim without writing changes to the kubeconfig file:

```bash
$ kubetrim --dry-run
```

Use a different kubeconfig file:

```bash
$ KUBECONFIG=$HOME/.kube/config.bak kubetrim
```

## Installation

Getting `kubetrim` with arkade:

```bash
curl -sfLS https://get.arkade.dev | sh

arkade get kubetrim
```

## License

MIT license
3 changes: 3 additions & 0 deletions hack/hashgen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

for f in bin/kubetrim*; do shasum -a 256 $f > $f.sha256; done

0 comments on commit 31c1515

Please sign in to comment.