Skip to content

JesseGoodier/kgng

Repository files navigation

Kubernetes Nodegroup Viewer (kgng)

A Python CLI tool that lists Kubernetes pods organized by nodegroup across different cloud providers (AWS EKS, GCP GKE, Azure AKS).

Features

  • Multi-cloud support: Detects and displays nodegroups from AWS EKS, GCP GKE, and Azure AKS
  • Interactive mode: Displays a menu of available nodegroups for selection
  • Non-interactive mode: Supports command-line arguments for filtering and automation
  • Rich output: Colorful, well-formatted tables showing pod details
  • Filtering options: Filter by nodegroup, namespace, or both
  • Pod status information: Shows ready status (e.g., "2/3") and container state with appropriate colors

Installation

From PyPI

pip install kgng

From Source

git clone https://github.com/example/kgng.git
cd kgng
pip install -e .

Prerequisites

  • Python 3.8 or higher
  • kubectl command-line tool configured with access to your Kubernetes cluster
  • Active Kubernetes context pointing to your cluster

Usage

Basic Usage

# Show all pods grouped by nodegroup (interactive mode by default)
kgng

# Show pods in a specific nodegroup
kgng --nodegroup my-nodegroup

# Show pods in a specific namespace
kgng --namespace kube-system

# Show pods in a specific nodegroup and namespace
kgng --nodegroup my-nodegroup --namespace kube-system

# Force non-interactive mode (show all pods by default)
kgng --no-prompt

Command-Line Options

  • --nodegroup: Filter pods by specific nodegroup
  • --namespace: Filter pods by specific namespace
  • --prompt: Force interactive mode
  • --no-prompt: Force non-interactive mode (show all pods by default)
  • --version: Display version information

Examples

Interactive Mode

When run without arguments, kgng enters interactive mode:

Available nodegroups:
1. standard-nodes (10 pods)
2. high-memory-nodes (5 pods)
3. gpu-nodes (3 pods)
4. All nodegroups (18 pods)

Select a nodegroup (1-4, or q to quit): 

Output Example

┌─────────────────────────────────────────────────────────────────────────────┐
│ Nodegroup: standard-nodes                                                   │
├───────────────┬───────────────────┬──────────┬────────┬────────────────────┤
│ Pod Name      │ Namespace         │ Status   │ Ready  │ Node               │
├───────────────┼───────────────────┼──────────┼────────┼────────────────────┤
│ nginx-abc123  │ default           │ Running  │ 1/1    │ ip-10-0-1-100.ec2… │
│ web-xyz456    │ web-frontend      │ Running  │ 2/2    │ ip-10-0-1-101.ec2… │
│ redis-def789  │ cache             │ Running  │ 1/1    │ ip-10-0-1-102.ec2… │
└───────────────┴───────────────────┴──────────┴────────┴────────────────────┘

Troubleshooting

Common Issues

  1. kubectl not found: Ensure kubectl is installed and in your PATH
  2. Permission errors: Make sure your kubectl context has sufficient permissions
  3. No nodegroups detected: Verify that your nodes have the appropriate labels for nodegroup detection

Debug Mode

For more detailed output, use the --debug flag:

kgng --debug

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

// Made with Bob

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages