A kubectl krew plugin that displays pod resource usage (CPU and memory) along with resource requests and limits. It works like kubectl top but also shows the resource requests and limits defined in the pod specifications.
Example output:
NAME CPU(cores) CPU REQUEST CPU LIMIT MEMORY(bytes) MEMORY REQUEST MEMORY LIMIT
my-pod-abc123 100m 200m 500m 128Mi 256Mi 512Mi
another-pod-xyz789 50m 100m 200m 64Mi 128Mi 256Mi
pod-without-limits 25m 50m - 32Mi 64Mi -
- Display pod CPU and memory usage (from Metrics API)
- Display CPU and memory requests and limits (from pod specs)
- Support namespace filtering (
-nor--namespace) - Support label selector filtering (
-lor--selector) - Support all flags from
kubectl top pods - Works with all namespaces by default
- Handles pods without defined requests/limits gracefully
- Display node CPU and memory usage (from Metrics API)
- Display aggregated total CPU and memory requests and limits from all pods on each node
- Show CPU% and MEMORY% (based on allocatable or capacity)
- Support label selector filtering (
-lor--selector) - Support all flags from
kubectl top node - Support node name as argument
- Converts request/limit units to the actual consumption units for easier comparison
- Go 1.25 or later (required for building from source)
- kubectl installed and configured
- Access to a Kubernetes cluster
- metrics-server installed in your cluster (required for Metrics API)
kubectl krew install rltop- Download the latest release for your platform from the Releases page
- Extract the archive
- Make the binary executable:
chmod +x kubectl-rltop
- Move it to a directory in your PATH:
sudo mv kubectl-rltop /usr/local/bin/
Note: Building from source requires Go 1.25 or later due to dependencies on the Kubernetes client libraries.
git clone https://github.com/veditoid/kubectl-rltop.git
cd kubectl-rltop
go build -o kubectl-rltop
sudo mv kubectl-rltop /usr/local/bin/You can use pod, pods, or po as the command name, just like kubectl:
kubectl rltop pod # Full form
kubectl rltop pods # Plural form
kubectl rltop po # Short formDisplay resource usage and requests/limits for all pods:
kubectl rltop pod
# or
kubectl rltop pods
# or
kubectl rltop pokubectl rltop pod -n default
# or
kubectl rltop pods --namespace kube-systemkubectl rltop pod -l app=myapp
# or
kubectl rltop pods --selector app=myapp,version=v1kubectl rltop pod -n production -l app=backendYou can use node, nodes, or no as the command name, just like kubectl:
kubectl rltop node # Full form
kubectl rltop nodes # Plural form
kubectl rltop no # Short formDisplay resource usage and aggregated requests/limits for all nodes:
kubectl rltop nodekubectl rltop node NODE_NAMEkubectl rltop node -l node-role.kubernetes.io/workerkubectl rltop node --sort-by=cpu
kubectl rltop node --sort-by=memorykubectl rltop node --show-capacitykubectl rltop node --no-headersThe output displays a table with the following columns:
- NAME: Pod name
- CPU(cores): Current CPU usage
- CPU REQUEST: Requested CPU resources
- CPU LIMIT: CPU limit
- MEMORY(bytes): Current memory usage
- MEMORY REQUEST: Requested memory resources
- MEMORY LIMIT: Memory limit
- Connects to your Kubernetes cluster using the kubeconfig
- Queries the Metrics API for pod CPU/memory usage (same as
kubectl top pods) - Fetches pod specifications to extract resource requests and limits
- Combines and formats the data in a table
If you see an error about the Metrics API not being available:
Error: metrics API not available: ...
Please ensure metrics-server is installed in your cluster
Install metrics-server in your cluster. For example, on minikube:
minikube addons enable metrics-serverIf you see "No pods found", check:
- Your namespace filter is correct
- Your label selector is correct
- You have the necessary permissions to list pods
- Go 1.25 or later
- Make (optional, but recommended)
Using Make:
make buildOr manually:
go build -o kubectl-rltopmake build-allThis will create binaries in the dist/ directory for:
- Linux (amd64, arm64)
- macOS (amd64, arm64)
- Windows (amd64)
Run unit tests:
make test-unitRun tests with coverage:
make test-coverageIntegration tests require a Kubernetes cluster. The tests use kind (Kubernetes in Docker) which works on Mac, Linux, and Windows.
Prerequisites:
Install kind:
# macOS
brew install kind
# Linux
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
# Windows (using Chocolatey)
choco install kindRun integration tests:
# The tests will automatically create a kind cluster if it doesn't exist
make test-integrationManual cluster management:
# Create kind cluster manually (optional)
make kind-create
# Check cluster status
make kind-status
# Delete kind cluster
make kind-deleteThe integration tests will:
- Create a kind cluster named
kubectl-rltop-test(if it doesn't exist) - Install metrics-server
- Create test pods with known resource requests/limits
- Run all integration tests
- Clean up test resources (but keep the cluster for reuse)
Run linters:
make lintFix linting issues automatically:
make lint-fixmake clean- Clean build artifactsmake install- Install the binary locallymake release- Create release artifactsmake verify- Run all verification checks (test + lint)make version- Show version information
# Test locally
./kubectl-rltop pod
# Test with namespace
./kubectl-rltop pod -n default
# Test with label selector
./kubectl-rltop pod -l app=myapp
# Check version
./kubectl-rltop versionReleases are automated using GoReleaser and krew-release-bot.
To automate plugin updates in the krew-index repository:
- Install the krew-release-bot GitHub App on your repository
- Grant it access to create pull requests in the
kubernetes-sigs/krew-indexrepository - The bot will automatically detect new git tags (e.g.,
v1.0.0) and create PRs to update the plugin in krew-index
When you push a new tag:
- GoReleaser creates the GitHub release with binaries
- krew-release-bot detects the tag and creates a PR to krew-index with updated manifest
- The PR is automatically tested and merged (usually within 5 minutes for trivial version bumps)
- Update the version in
VERSIONfile - Update
.krew.yamlwith the new version (the bot will update SHA256 checksums automatically) - Commit and push the changes
- Create and push a git tag:
git tag v1.0.0 git push origin v1.0.0
- The release workflow will automatically:
- Build binaries for all platforms
- Create a GitHub release
- krew-release-bot will create a PR to krew-index
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Ensure all checks pass (
make verify) - Submit a pull request
See CHANGELOG.md for a list of changes and version history.
This project is licensed under the Apache License 2.0. See LICENSE for details.
- Inspired by
kubectl top pods - Built with k8s.io/client-go
- Uses spf13/cobra for CLI