A kubectl plugin for viewing Kubernetes cluster resource allocation, utilization, and live monitoring. Provides quick insights into CPU and memory usage across nodes, namespaces, pods, and deployments.
- 📊 Multiple Output Formats - Text, Pretty tables, JSON, Dashboard, Pie charts, and more
- 🔄 Live Monitoring - Real-time TUI with auto-refresh for continuous observation
- 🎯 Multiple View Modes - Nodes (default), Namespaces with navigation, Pods, and Deployments
- 📈 Resource Metrics - CPU and memory requests, limits, and actual usage with ratio formatting
- ☁️ Cloud Provider Integration - Auto-detects AWS/GCP and displays node metadata if present; columns hidden on bare-metal unless enabled
- 🔍 Flexible Filtering - Label and field selectors for targeted views
- 📏 Value Display Options - Human-readable ratios or raw Kubernetes resource values
- 🛠️ Performance Optimizations - Parallel API fetching, watch cache, and batch operations for large clusters
- Installation
- Quick Start
- Usage
- Output Formats
- Filtering and Selection
- Cloud Provider Integration
- Configuration
- Examples
- Requirements
- Development
- License
The easiest way to install glance is through krew:
kubectl krew update
kubectl krew install glanceBuild from source with Go 1.25 or higher:
git clone https://gitlab.com/davidxarnold/glance.git
cd glance
make build
cp target/kubectl-glance /usr/local/bin/# View cluster resources (pretty output is now the default)
kubectl glance
# Start live monitoring with interactive TUI
kubectl glance live
# View with simple text output (no colors)
kubectl glance -o txt
# Monitor specific namespace pods in real-time
kubectl glance live # then press 'p' and use ←→ to navigate namespaceskubectl glance provides a point-in-time snapshot of cluster resources, showing allocation and utilization across nodes.
kubectl glanceExample Output:
┌──────────────────────────────────────────────────────────────────────────────┐
│ CLUSTER: https://k8s.example.com:6443 │
│ CPU: ████████░░░░░░░░░░░░ 44.4% (7.1/16) Nodes: 3 Ready │
│ MEM: ██████░░░░░░░░░░░░░░ 19.4% (6.1/31.4Gi) │
└──────────────────────────────────────────────────────────────────────────────┘
NODE NAME STATUS PROVIDERID ALLOCATABLE ALLOCATABLE ALLOCATED ALLOCATED USAGE USAGE
CPU MEM CPU REQ CPU LIM CPU MEM
node-1 Ready aws://... 4 8053040Ki 1.250 2.000 0.186 1172Mi
node-2 Ready aws://... 4 8053040Ki 2.100 3.500 1.420 1856Mi
node-3 Ready aws://... 8 16106080Ki 3.750 6.000 2.340 3240Mi
TOTALS 16 32212160Ki 7.100 11.500 3.946 6268Mi
Choose from multiple output formats to suit your workflow:
| Format | Flag | Description |
|---|---|---|
| Pretty | pretty (default) |
Colorful table with cluster summary, progress bars, and status icons |
| Text | txt |
Clean ASCII table with borders, utilization percentages, and capacity summary |
| JSON | json |
Machine-readable JSON for scripting/automation |
| Dashboard | dash |
Terminal dashboard with visual elements |
| Pie Chart | pie |
Resource allocation pie chart visualization |
| Chart | chart |
Resource usage charts and graphs |
Examples:
# Default pretty output with cluster summary and visual indicators
kubectl glance
# Simple text output with ASCII borders
kubectl glance -o txt
# JSON output for automation
kubectl glance -o json | jq '.totals.totalUsageCPU'
# Visual dashboard
kubectl glance -o dash
# Pie chart visualization
kubectl glance -o pie# Show cloud provider columns (AWS/GCP node details) if detected (default)
kubectl glance
# Force cloud info columns ON (even on bare-metal)
kubectl glance --show-cloud-provider=true
# Force cloud info columns OFF (even if detected)
kubectl glance --show-cloud-provider=false
# Display pod-level resource details
kubectl glance -p
kubectl glance --pods
# Show exact values instead of human-readable (e.g., 1000m vs 1)
kubectl glance --exact
# Combine options
kubectl glance -c -p -o pretty --exactkubectl glance live provides a continuously updating TUI (Terminal User Interface) for real-time cluster monitoring, similar to kubectl top but with much richer information and multiple view modes.
kubectl glance liveFeatures:
- 🔄 Auto-refresh every 2 seconds (configurable)
- 🎯 Four different view modes
- ⌨️ Keyboard-driven navigation
- 📊 Live resource metrics from metrics-server
- 📊 Visual progress bars with color indicators (🟢🟡🔴)
- 📈 Cluster summary dashboard showing aggregate stats
- ✓ Status icons for nodes, pods, and deployments
- 🎨 Color-coded rows based on utilization levels
- 🎛️ Interactive toggles for display options
- 📱 Terminal responsive
Switch between views using keyboard shortcuts:
| Key | View | Description |
|---|---|---|
| o | Nodes | Node capacity, allocation, and current usage across cluster (default) |
| n | Namespaces | Resource requests, limits, and usage per namespace (navigate with ↑↓, Enter to view) |
| p | Pods | Resource requests, limits, and usage per pod with namespace selection |
| d | Deployments | Deployment resources, replica counts, and availability status |
Default View: Nodes view shows cluster-wide node status on startup.
Namespace Navigation:
- In Namespaces view: Use ↑↓ arrows to select a namespace, press Enter to view pods in that namespace
- In Pods/Deployments views: Use ←→ arrows to cycle through namespaces
- Use
--namespaceor-Nflag to start with a specific namespace
Sort Modes: Press s to cycle through sort modes:
- Status (default) - Non-running/NotReady items first
- Name - Alphabetical order
- CPU - By CPU usage descending
- Memory - By memory usage descending
| Key | Action |
|---|---|
n |
Switch to Namespaces view |
p |
Switch to Pods view |
o |
Switch to Nodes view |
d |
Switch to Deployments view |
b |
Toggle progress bars on/off |
% |
Toggle percentages on progress bars |
r |
Toggle raw data display (e.g., "1500m" vs "1.5 / 2.0") |
s |
Cycle sort mode (Status → Name → CPU → Memory) |
c |
Toggle compact mode (hide summary and help) |
i |
Toggle cloud info columns (Provider, Region, Instance Type) |
v |
Toggle node version column (Kubelet version) |
a |
Toggle node age column (time since creation) |
+/- |
Increase/decrease display limits (nodes or pods by 10) |
l |
Cycle through preset limits (20/50/100/500/1000) |
↑↓ |
Select namespace (in Namespaces view) |
Enter |
View pods for selected namespace (in Namespaces view) |
←→ |
Navigate namespaces (in Pods/Deployments view) |
q |
Quit live view |
Progress Bars:
- Visual bars under each resource metric (CPU request, limit, usage; Memory request, limit, usage)
- Shows resource utilization at a glance with filled/unfilled blocks
- Toggle with
bkey - Optional percentage display with
%key
Menu Bar:
- Bottom menu shows current toggle states with checkboxes (☑/☐)
- Indicates which features are enabled/disabled
- Always visible for quick reference
Compact Mode:
- Toggle with
ckey - Hides detailed help text to maximize data display area
- Useful for smaller terminals or when focused on metrics
# Start live view with default settings
kubectl glance live
# Custom refresh interval (5 seconds)
kubectl glance live -r 5
kubectl glance live --refresh 10
# Workflow examples:
# 1. Start in namespaces view, toggle bars and percentages
kubectl glance live
# Press 'b' to see progress bars
# Press '%' to add percentages to bars
# 2. Monitor specific namespace pods
kubectl glance live
# Press 'p' to switch to pods view
# Use ←→ to navigate to your namespace
# 3. Compact mode for smaller terminals
kubectl glance live
# Press 'c' to enable compact mode
# Press 'b' to hide bars if needed
# 4. Node monitoring with visual feedback
kubectl glance live
# Press 'o' for nodes view
# Progress bars show capacity utilizationThe live view now includes a cluster summary dashboard and color-coded progress bars:
┌─────────────────────────────────────────────────────────────────────────────┐
│ CLUSTER SUMMARY │
│ CPU: 🟢 ████████░░░░░░░░ 45.2% (7.2/16 cores) Nodes: ✓ 3 healthy │
│ MEM: 🟡 ██████████████░░ 72.5% (23.2/32 Gi) Pods: 42 running │
└─────────────────────────────────────────────────────────────────────────────┘
NODE STATUS CPU CAP CPU ALLOC CPU USE MEM CAP MEM ALLOC MEM USE PODS
node-1 ✓ Ready 4 2.5 1.8 8Gi 4Gi 3.2Gi 15
🟡 ████████████░░░░ 45%
🟡 ██████████████░░ 63%
🟢 ██████████░░░░░░ 45%
node-2 ✓ Ready 4 3.0 2.1 8Gi 6Gi 5.8Gi 18
🟡 ████████████████ 75%
🔴 ██████████████████ 95%
🟡 ██████████████░░ 73%
Color Indicators:
- 🟢 Green: < 50% utilization (healthy)
- 🟡 Yellow: 50-90% utilization (warning)
- 🔴 Red: > 90% utilization (critical)
Status Icons:
- ✓ Ready / ⊘ NotReady (nodes)
- ● Running / ○ Pending / ✗ Failed (pods)
- ✓ Ready / ✗ NotReady / ○ Partial (deployments)
The bars use Unicode block characters (█ for filled, ░ for empty) to provide instant visual feedback on resource utilization.
Namespaces View (n)
- Lists all namespaces in the cluster
- CPU and memory requests/limits/usage per namespace
- Pod count per namespace
- Sorted alphabetically
Pods View (p)
- Lists all pods in selected namespace
- CPU and memory requests/limits/usage per pod
- Pod status (Running, Pending, etc.)
- Navigate namespaces with ←→ arrows
Nodes View (o)
- Lists all nodes in the cluster
- Node capacity (total available resources)
- Allocated resources (sum of pod requests)
- Actual usage from metrics-server
- Pod count per node
Deployments View (d)
- Lists all deployments in selected namespace
- Total resource requests/limits across all replicas
- Desired replica count
- Ready replica count
- Available replica count
- Navigate namespaces with ←→ arrows
Glance supports multiple output formats for different use cases:
Clean ASCII table with borders, status column, utilization percentages, and cluster capacity summary. Ideal for environments without color support or for piping to other tools.
kubectl glance -o txtFeatures:
- ASCII box borders for clear structure
- Sorted node output for consistency
- CPU % and MEM % utilization columns
- Node status column (Ready/NotReady)
- Cluster capacity summary section
Full-featured colored output with cluster summary dashboard, progress bars, and status indicators. Best for interactive terminal sessions.
kubectl glance
kubectl glance -o prettyFeatures:
- 📊 Cluster summary dashboard with aggregate CPU/memory stats
- 📈 Visual progress bars with utilization percentages
- 🟢🟡🔴 Color-coded indicators based on thresholds (<50% green, 50-90% yellow, >90% red)
- ✓/⊘ Status icons for node health
- 📉 Sparkline trend indicators
- Grouped display (NotReady nodes shown first)
- Color-coded utilization cells
Machine-readable JSON output perfect for automation, monitoring systems, and scripting.
kubectl glance -o json
# Example: Extract total CPU usage with jq
kubectl glance -o json | jq -r '.totals.totalUsageCPU'
# Example: Get all node stats
kubectl glance -o json | jq '.nodeMap'JSON Structure:
{
"nodeMap": {
"node-1": {
"nodeName": "node-1",
"status": "Ready",
"allocatableCPU": "4",
"allocatableMemory": "8053040Ki",
"totalAllocatedCPUrequests": "1.25",
"totalAllocatedCPULimits": "2.0",
"totalAllocatedMemoryRequests": "396Mi",
"totalAllocatedMemoryLimits": "1024Mi",
"usageCPU": "0.186",
"usageMemory": "1172Mi"
}
},
"totals": {
"totalAllocatableCPU": "4",
"totalAllocatableMemory": "8053040Ki",
...
}
}Terminal-based dashboard with visual elements and organized sections.
kubectl glance -o dashVisual representations of resource utilization:
# Pie chart showing resource distribution
kubectl glance -o pie
# Bar charts and graphs
kubectl glance -o chartFilter resources using Kubernetes label and field selectors:
# Filter nodes by environment label
kubectl glance --selector environment=production
# Multiple labels (AND logic)
kubectl glance --selector app=nginx,tier=frontend
# Short form
kubectl glance -l app=myapp# Filter by specific field values
kubectl glance --field-selector metadata.name=node-1
# Multiple field selectors
kubectl glance --field-selector status.phase=Running,spec.nodeName=node-1# Combine label and field selectors
kubectl glance --selector app=nginx --field-selector status.phase=Running -o prettyGlance can fetch additional metadata from cloud providers (AWS and GCP) to enrich node information. Cloud provider columns are shown by default only if a supported provider is detected (AWS/GCP). On bare-metal or unknown providers, columns are hidden unless the flag is set.
# Cloud info columns are shown by default if AWS/GCP is detected
kubectl glance
# Force cloud info columns ON (even on bare-metal)
kubectl glance --show-cloud-provider=true
# Force cloud info columns OFF (even if detected)
kubectl glance --show-cloud-provider=falseWhat You Get:
- AWS EC2: Instance type, availability zone, region, instance ID
- GCP GCE: Machine type, zone, project ID, instance ID
Cloud provider credentials must be configured:
AWS:
- AWS credentials in
~/.aws/credentialsor environment variables - IAM permissions:
ec2:DescribeInstances
GCP:
- Application Default Credentials or service account
- Permissions:
compute.instances.get
Behavior:
- If no supported cloud provider is detected, glance hides cloud columns by default (no API calls made)
- Use
--show-cloud-provider=trueto force columns on, or--show-cloud-provider=falseto force off
# View with cloud provider columns (if detected)
kubectl glance -o pretty
# Force cloud columns ON
kubectl glance --show-cloud-provider=true -o pretty
# JSON output always includes cloud fields if present
kubectl glance -o json | jq '.nodeMap[].cloudInfo'| Flag | Short | Default | Description |
|---|---|---|---|
--output |
-o |
pretty |
Output format: txt, pretty, json, dash, pie, chart |
--show-cloud-provider |
-c |
auto |
Display cloud provider metadata (AWS/GCP instance types, regions) if detected; force on/off with true/false |
--pods |
-p |
false |
Display pod-level resource details in static view |
--exact |
false |
Show exact Kubernetes resource values instead of human-readable | |
--selector |
-l |
Label selector for filtering (e.g., app=nginx) |
|
--field-selector |
Field selector for filtering (e.g., status.phase=Running) |
| Flag | Short | Default | Description |
|---|---|---|---|
--refresh |
-r |
2 |
Refresh interval in seconds |
--namespace |
-N |
Initial namespace for pods/deployments view (empty = all namespaces) | |
--node-limit |
20 |
Maximum number of nodes to display (0 = unlimited) | |
--pod-limit |
100 |
Maximum number of pods to display (0 = unlimited) | |
--sort-by |
status |
Sort mode: status, name, cpu, memory |
|
--max-concurrent |
50 |
Maximum concurrent API requests for parallel fetching |
Notes:
--node-limitand--pod-limitare useful for large clusters (>100 nodes) to improve performance- Sort mode can be changed dynamically in live view by pressing
s - Namespace can be changed interactively using Left/Right arrow keys
Glance respects standard Kubernetes environment variables:
# Use specific kubeconfig
export KUBECONFIG=~/.kube/config-production
kubectl glance
# Set default namespace
export KUBECTL_NAMESPACE=my-namespace
kubectl glance
# Set log level (trace, debug, info, warn, error, fatal)
# When set to debug or info, logs are written to ~/.glance/<level>-glance.log
export GLANCE_LOG_LEVEL=debug
kubectl glanceCreate ~/.glance for persistent configuration (YAML format):
selector: "environment=production"
output: pretty
show-cloud-provider: auto # auto (default), true, or false
exact: false
log-level: warn # trace, debug, info, warn, error, fatal
namespace: "" # Initial namespace for live view (empty = all namespaces)
# Cloud info caching (live mode only)
cloud-cache-ttl: 5m # TTL for cloud provider info cache (default: 5m)
cloud-cache-disk: false # Persist cache to ~/.glance/cloud-cache.json (default: false)
# Column visibility (live mode - persisted when toggled with i/v/a keys)
show-node-version: false # Show node version column (default: false)
show-node-age: false # Show node age column (default: false)Cloud Cache Settings:
cloud-cache-ttl: Duration to cache AWS/GCP instance type info. Valid units: s, m, h. Example:300s,5m,1hcloud-cache-disk: Whentrue, cache persists between sessions in~/.glance/cloud-cache.json
Column Visibility:
- Initial state loaded from config file
- Changes made with
i(cloud),v(version),a(age) keys are automatically saved - Requires config file to exist for persistence
By default, glance uses warn level logging which minimizes terminal output. For debugging:
- Set
GLANCE_LOG_LEVEL=debugenvironment variable, or - Add
log-level: debugto your~/.glanceconfig file
Log files are written to:
~/.glance/<level>-glance.log(preferred), or/tmp/<level>-glance.log(fallback)
Log files are only created for trace, debug, or info levels.
# Quick cluster overview
kubectl glance -o pretty
# Monitor production namespace in real-time
kubectl glance live
# Press 'p' for pods, then navigate to production namespace
# Check specific application resources
kubectl glance --selector app=nginx -p -o pretty
# Export cluster state for reporting
kubectl glance -o json > cluster-report-$(date +%Y%m%d).json
# Compare resource requests vs usage
kubectl glance -o pretty | grep -E "ALLOCATED|USAGE"
# Monitor cluster during deployment
kubectl glance live -r 1 # 1-second refresh
# Check nodes with cloud info
kubectl glance -c --field-selector metadata.name=node-1
# Get exact values for billing/capacity planning
kubectl glance --exact -o json > capacity-report.json#!/bin/bash
# Alert if CPU usage exceeds 80%
USAGE=$(kubectl glance -o json | jq -r '.totals.totalUsageCPU' | cut -d'.' -f1)
if [ "$USAGE" -gt 80 ]; then
echo "ALERT: CPU usage at ${USAGE}%"
# Send notification...
fi#!/bin/bash
# Daily capacity report
kubectl glance --exact -o json | jq '{
date: now | strftime("%Y-%m-%d"),
totalNodes: .nodeMap | length,
totalCPU: .totals.totalAllocatableCPU,
usedCPU: .totals.totalUsageCPU,
totalMemory: .totals.totalAllocatableMemory,
usedMemory: .totals.totalUsageMemory
}' > capacity-$(date +%Y%m%d).json- Kubernetes: 1.12 or higher (tested with 1.31)
- Metrics Server: Required for usage statistics and live view
- Install:
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
- Install:
- kubectl: 1.12 or higher
- Go: 1.25 or higher (for building from source)
- Terminal: Supports ANSI colors (for pretty output and live view)
Required RBAC permissions:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: glance-viewer
rules:
- apiGroups: [""]
resources: ["nodes", "pods", "namespaces"]
verbs: ["get", "list"]
- apiGroups: ["apps"]
resources: ["deployments"]
verbs: ["get", "list"]
- apiGroups: ["metrics.k8s.io"]
resources: ["nodes", "pods"]
verbs: ["get", "list"]Glance is optimized for large Kubernetes clusters with advanced performance features:
- Parallel API Fetching - Uses Go errgroup for concurrent node, pod, and namespace queries
- Watch Cache - Leverages Kubernetes API server's watch cache (
resourceVersion="0") to reduce etcd load - Batch Operations - Single pod list call with in-memory grouping eliminates N+1 query problem
- Smart Limits - Configurable node and pod limits prevent display overload in large clusters
| Cluster Size | Startup Time | Recommendations |
|---|---|---|
| < 20 nodes | ~1-2 seconds | Default settings work great |
| 20-100 nodes | ~2-4 seconds | Use default --node-limit=20 for live view |
| 100-500 nodes | ~5-10 seconds | Increase --node-limit as needed, use --sort-by strategically |
| 500+ nodes | ~10-20 seconds | Consider watch cache mode (future feature), use higher --max-concurrent |
Glance automatically detects large clusters (>100 nodes) and warns about performance considerations:
# For clusters with 100+ nodes, glance shows a warning:
WARN Large cluster detected (150 nodes). Using --node-limit=20 for performance.
Consider using --watch mode for real-time updates with lower API load.# Increase display limits for larger terminals
kubectl glance live --node-limit=50 --pod-limit=200
# Increase API concurrency for faster fetching
kubectl glance live --max-concurrent=100
# Sort by specific criteria to focus on problem areas
kubectl glance live --sort-by=cpu # Show highest CPU usage first# Build binary
make build
# Run tests
make test
# Run linter
make lint
# Format code
make fmt
# Check everything
make checkglance/
├── cmd/ # Main application entry point
├── pkg/
│ ├── cmd/ # Command implementations
│ │ ├── glance.go # Main command and static view
│ │ ├── live.go # Live TUI implementation
│ │ ├── render.go # Output formatting
│ │ ├── types.go # Data structures
│ │ ├── aws.go # AWS integration
│ │ └── gce.go # GCP integration
│ └── util/ # Utility functions
├── plugins/krew/ # Krew plugin manifest
└── version/ # Version information
# Run all tests
go test ./...
# Run with coverage
go test -cover ./...
# Run specific test
go test ./pkg/cmd -run TestLive- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Run
make check - Submit a pull request
The project uses GitLab CI/CD to automate releases. Here's how to create a new release:
GL_CI_TOKENCI/CD variable set in GitLab with write access to the repository- Version updated in
version/version.go
# 1. Update version in version/version.go
vim version/version.go
# 2. Build all platforms, create archives, generate checksums, update krew manifest
make release
# 3. Review the updated krew manifest
cat plugins/krew/glance.yaml
# 4. Commit and tag
git add -A && git commit -m "Release v$(make release_version)"
make tag-release
git push && git push --tags
# 5. Upload archives to GitLab release page
# Files are in: target/archives/Simply push a version tag to trigger the full release pipeline:
# 1. Update version in version/version.go and commit
vim version/version.go
git add -A && git commit -m "Prepare release v0.1.0"
git push
# 2. Create and push tag (triggers release)
git tag v0.1.0
git push --tagsThe CI pipeline will automatically:
- Run lint and tests
- Build binaries for all platforms (darwin/linux amd64/arm64, windows amd64)
- Create
.tar.gzarchives - Generate SHA256 checksums
- Create a GitLab Release with downloadable artifacts
- Update the krew manifest with new version and checksums
| Platform | Archive |
|---|---|
| macOS Intel | kubectl-glance-VERSION-darwin-amd64.tar.gz |
| macOS Apple Silicon | kubectl-glance-VERSION-darwin-arm64.tar.gz |
| Linux x86_64 | kubectl-glance-VERSION-linux-amd64.tar.gz |
| Linux ARM64 | kubectl-glance-VERSION-linux-arm64.tar.gz |
| Windows x86_64 | kubectl-glance-VERSION-windows-amd64.tar.gz |
| Target | Description |
|---|---|
make build-all |
Build binaries for all platforms |
make archive-all |
Create archives (depends on build-all) |
make checksums |
Generate SHA256 checksums (depends on archive-all) |
make krew-plugin |
Update krew manifest with checksums (depends on checksums) |
make release |
Full release pipeline (build → archive → checksum → manifest) |
make krew-validate |
Test krew manifest locally |
make krew-reset |
Reset krew manifest to git version |
make clean |
Remove build artifacts |
After creating a release:
- Fork kubernetes-sigs/krew-index
- Copy
plugins/krew/glance.yamltoplugins/glance.yamlin your fork - Submit a PR to the krew-index repository
- Wait for review and approval
Apache License 2.0 - See LICENSE for details.
- Issues: https://gitlab.com/davidxarnold/glance/-/issues
- Repository: https://gitlab.com/davidxarnold/glance
Built with:
