Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gmeghnag/koff
Inspect Kubernetes yaml/json manifests and etcd snapshot offline with koff!
https://github.com/gmeghnag/koff
cli kubernetes openshift yaml
Last synced: about 1 month ago
JSON representation
Inspect Kubernetes yaml/json manifests and etcd snapshot offline with koff!
- Host: GitHub
- URL: https://github.com/gmeghnag/koff
- Owner: gmeghnag
- Created: 2023-05-17T07:36:45.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-06T08:20:25.000Z (10 months ago)
- Last Synced: 2024-10-02T06:03:01.886Z (about 2 months ago)
- Topics: cli, kubernetes, openshift, yaml
- Language: Go
- Homepage: https://gmeghnag.github.io/koff
- Size: 18.9 MB
- Stars: 16
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `koff`
[![GitHub Actions Build Status](https://github.com/gmeghnag/koff/actions/workflows/build.yml/badge.svg)](https://github.com/gmeghnag/koff/actions?query=workflow%3ABuild)
![Downloads](https://img.shields.io/github/downloads/gmeghnag/koff/total)`koff` is a command-line tool that processes Kubernetes `yaml|json` manifests and returns their appropriate tabular format, as well as `yaml` or `json`.
## **¿What?**
It allows you to process Kubernetes resources in `yaml` or `json` format, from either file or piped input or etcd snapshot file.
It reads input, performs the specific filter operations based on the flags and arguments (if provided), and writes the output in either tabular (as default), `json` or `yaml` format.## **¿Why?**
Helpful in conjunction with `kubectl` to take a "snapshot" of specific resources at that specific point in time and parse the same later on.## **¿How?**
- Via piped input:
```
$ cat resources.yaml | koff get pod/postgresql-1-2gxpm svc/postgresql
NAME READY STATUS RESTARTS AGE
pod/postgresql-1-2gxpm 1/1 Running 0 15mNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/postgresql ClusterIP 172.30.58.223 5432/TCP 16m
```
- Referencing the file to use via `koff use .yaml` before executing `koff`:
```
$ koff use resources.yaml
$ koff get pod/postgresql-1-2gxpm svc/postgresql
NAME READY STATUS RESTARTS AGE
pod/postgresql-1-2gxpm 1/1 Running 0 15mNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/postgresql ClusterIP 172.30.58.223 5432/TCP 16m
```
- Using an etcd snapshot to get the Kubernetes object contained in it:
```
$ koff etcd inspect etcd_snap.db /kubernetes.io/pods/openshift-etcd/testocp-bqgqk-master-0-debug -o yaml
apiVersion: v1
kind: Pod
metadata:
annotations:
debug.openshift.io/source-container: container-00
debug.openshift.io/source-resource: /v1, Resource=nodes/testocp-bqgqk-master-0
creationTimestamp: "1995-01-17T00:0:00Z"
...
...$ koff etcd inspect etcd_snap.db /kubernetes.io/pods/openshift-etcd/testocp-bqgqk-master-0-debug | koff
NAME READY STATUS RESTARTS AGE
pod/testocp-bqgqk-master-0-debug 0/1 Pending 0 22h```
## Installation
### Using `go`
```
go install github.com/gmeghnag/koff
```
### Download the latest binary
```
OS=Linux # or Darwin
curl -sL "https://github.com/gmeghnag/koff/releases/latest/download/koff_${OS}_x86_64.tar.gz" | tar xzf - koff
chmod +x ./koff
```
### Build from source
```
$ git clone https://github.com/gmeghnag/koff.git
$ cd koff/
$ go install
```## Upgrade
It's possible to upgrade the tool to the latest version by running `koff upgrade --to=latest`