Skip to content

isimtekin/kube-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

kube-utils

A set of handy Zsh-based command-line utilities to simplify and speed up working with Kubernetes clusters.

πŸš€ Features

  • βœ… List services with namespace, cluster-local URL, and exposed ports (kservices)
  • βœ… View pods in wide format (IP, Node, Status) (kpods)
  • βœ… Tail logs of the latest pod matching a name (kf)
  • βœ… Open a shell inside a pod (ksh)
  • βœ… List ingress domains and paths (kingress)
  • βœ… Detect crash or image pull errors in pods (kcrash)
  • βœ… Search within ConfigMaps and Secrets (kfind)
  • βœ… List top pods by CPU usage (ktop)
  • βœ… Show the most recently created pod (knewest)
  • βœ… Switch between Kubernetes contexts (kctx)
  • βœ… Change namespace in current context (kns)
  • βœ… List all deployments across namespaces (kdeploys)
  • βœ… Monitor rollout status of a deployment (krollout)
  • βœ… Port-forward pod to localhost (kportfwd)
  • βœ… List all container images used in deployments (kimg)
  • βœ… Launch a temporary BusyBox pod for debugging (kdebug)
  • βœ… Clean up completed or evicted pods (kclean)
  • βœ… Execute a command inside a pod (kexec)
  • βœ… View Kubernetes node info and resource capacity (knodes)
  • βœ… Annotate a resource (kannotate)
  • βœ… Compare live deployment YAML with a local manifest (kdiff)
  • βœ… Backup full cluster resources and Helm releases (kbackup)
  • βœ… Restore from cluster resource and Helm manifest backups (krestore)
  • βœ… Copy a Secret from one namespace to another (ktmvsecret)

πŸ“¦ Installation

You can add this utility set to your machine with a simple curl command:

curl -o ~/.kube-utils.zsh https://raw.githubusercontent.com/isimtekin/kube-utils/main/.kube-utils.zsh
echo 'source ~/.kube-utils.zsh' >> ~/.zshrc
echo 'alias kube-utils-update="curl -fsSL https://raw.githubusercontent.com/isimtekin/kube-utils/main/.kube-utils.zsh -o ~/.kube-utils.zsh && source ~/.kube-utils.zsh"'  >> ~/.zshrc
source ~/.zshrc

⚠️ You need to have kubectl and column installed. Most systems already have column. Optionally, you can install jq for extended features.

πŸ§ͺ Usage

kservices [namespace]             # List services with their URLs and ports
kpods [namespace]                 # Show pods with wide output
kf <namespace> <name-pattern>     # Tail logs of latest pod matching pattern
ksh <namespace> <pod-name>        # Start shell inside a pod
kingress                          # Show ingress domain and path mappings
kcrash                            # List pods in error or crash loop
kfind <configmap|secret> <kw>    # Search inside ConfigMaps or Secrets
ktop                              # Show top 10 pods by CPU
knewest [namespace]               # Most recently created pod
kctx                              # Show current context and list all
kns <namespace>                   # Change the active namespace
kdeploys                          # List all deployments across namespaces
krollout <deployment> [ns]        # Watch rollout status of a deployment
kportfwd <ns> <name> <lport> <rport> # Port forward a pod to localhost
kimg                              # List all images used in deployments
kdebug                            # Launch temporary BusyBox pod for debugging
kclean                            # Clean up completed and evicted pods
kexec <ns> <pod> <cmd>            # Execute command in a pod
knodes                            # Show node info and resource capacity
kannotate <res> <name> <k> <v>    # Add or update annotation on a resource
kdiff <ns> <deployment>           # Diff live deployment with local manifest
kbackup                            # Backup all namespaces, resources, and Helm manifests
krestore <path>                    # Restore Kubernetes resources and Helm manifests from backup
ktmvsecret <secret> <source-ns> <target-ns> [new-name]  # Copy a secret between namespaces

All commands are namespace-aware and safe to run.

πŸ‘€ Author

Ersin Isimtekin

πŸͺͺ License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages