-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
- Loading branch information
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |