Skip to content

lassoColombo/nuke

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Nuke

A Nushell-native Kubectl-get

Nuke – A Nushell-native kubectl get


Nuke brings Kubernetes resource inspection to Nushell, and it does so natively: it implements Nushell commands equivalent to various kubectl commands that retrieve data from the Kubernetes API server and returns the result the Nushell way.

In other words, Nuke aims to return data that is:

  • Structured
  • Queryable
  • Typed

Nuke does not aim to exactly replicate kubectl.
Instead, it provides a Nushell-native experience, returning structured and often richer data.

Nuke does not aim to reimplement all of kubectl.
Instead, it focuses on those commands where Nushell’s structured data provides the most value.


Currently implemented:

Command Equivalent of
nuke show kubectl get
nuke api resources kubectl api-resources
nuke api versions kubectl api-versions

Nuke Show

The nuke show command supports three output formats:

Format Description
compact Similar to kubectl get <resource>
wide Similar to kubectl get <resource> -o wide
full Returns the complete objects as presented by the API server. This has no direct kubectl equivalent

The compact format is the default when retrieving a list of objects, while wide is the default for single objects.

Note: Nuke is under active development. Not all resources currently support compact and wide formats — when unavailable, Nuke falls back to full. If a resource is not yet supported feel free to look into fmt.nu and open a pull request (see the Contributing section).

Installation

Clone this repository into one of your $env.NU_LIB_DIRS:

git clone git@github.com:lassoColombo/nuke.git ([($env.NU_LIB_DIRS | first) nuke] | path join)

Run your first commands:

use nuke
nuke api resources
# The first run might take a while as Nuke scans the cluster to collect the list of supported API resources.
# This data is cached under ~/.cache/nuke and can be refreshed manually by deleting that folder.

Then, start exploring:

alias kk = nuke show

kk po
kk po --show-labels
kk po a-po
kk po a-po --show-conditions
kk po a-po --o full
kk po --all

Update Nuke

cd ([($env.NU_LIB_DIRS | first) nuke] | path join) # or wherever you cloned nuke
git pull

Dependencies

Nuke is designed to be as Nushell-native as possible.
However, until the Nushell http-client provides all needed authentication functionalities, a few external tools are used:

  • curl — soemtimes used for direct HTTP calls to the Kubernetes API server

Configuration

Nuke uses your existing Kubernetes configuration ($env.KUBECONFIG, usually ~/.kube/config).
No additional setup is required.

Optionally, you can define a short alias for the show command:

alias kk = nuke show

Directory Specification

Nuke adheres to the XDG Directory Specification:

  • cache lives in ($env.XDG_CACHE_HOME? | default ([$env.HOME .cache] | path join))

Authentication

Nuke reads $env.KUBECONFIG to determine the active context and authentication method, then uses those credentials to perform direct HTTP calls to the API server.

Currently supported authentication methods:

  • Token-based (hardcoded in kubeconfig)
  • Certificate-based (hardcoded in kubeconfig)

Planned:

  • OIDC
  • Exec plugins

Contributing

Contributions, bug reports, and feature requests are truly welcome. Please open an issue or pull request if you’d like to help improve Nuke.

working on Nuke

  1. If you have a cluster and kubectl can access it, so can nuke (as long as the authentication method to the cluster is supported).
    If you do not have a cluster you can kindly create it: kind create cluster --name my-cluster
  2. use nuke
  3. nuke show <my-unsupported-resource>
  4. nuke show <my-unsupported-resource> | my-custom-formatter -o [wide|compact] until you are happy with your formatter

Roadmap

  • Implement compact and wide formatters for the standard resources
  • Extend nuke show:
    • Implement --watch flag
    • Support the all pseudo-resource (nuke show all -n kube-system)
  • Implement nuke describe command?
  • Implement additional authentication methods:
    • OIDC
    • Exec plugins

Resources Implementation Status

Coverage

pie title Resource Coverage
    "supported" : 29
    "unsupported" : 30
    "unwilling to support" : 2

Loading

List

Resource Status
componentstatuses 🔴
configmaps 🟢
endpoints 🔴
events 🟢
limitranges
namespaces 🟢
nodes 🟢
persistentvolumeclaims 🟢
persistentvolumes 🟢
pods 🟢
podtemplates 🟢
replicationcontrollers
resourcequotas
secrets 🟢
serviceaccounts 🟢
services 🟢
apiservices 🟢
controllerrevisions 🟢
daemonsets 🟢
deployments 🟢
replicasets 🟢
statefulsets 🟢
events 🟢
horizontalpodautoscalers
horizontalpodautoscalers
cronjobs 🟢
jobs 🟢
certificatesigningrequests
ingressclasses
ingresses
ipaddresses 🟢
networkpolicies 🟢
servicecidrs 🟢
poddisruptionbudgets
clusterrolebindings 🟢
clusterroles 🟢
rolebindings 🟢
roles 🟢
csidrivers
csinodes
csistoragecapacities
storageclasses
volumeattachments
volumeattributesclasses
mutatingwebhookconfigurations
validatingadmissionpolicies
validatingadmissionpolicybindings
validatingwebhookconfigurations
customresourcedefinitions
priorityclasses 🟢
leases
runtimeclasses
endpointslices 🟢
deviceclasses
resourceclaims
resourceclaimtemplates
resourceslices
flowschemas
prioritylevelconfigurations

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published