|  | 
|  | 1 | +--- | 
|  | 2 | +// filepath: /Users/anveshmuppeda/Desktop/anvesh/tech/git/kubernetes/docs/eks/008-eks-node-viewer.md | 
|  | 3 | +sidebar_label: "EKS Node Viewer" | 
|  | 4 | +sidebar_position: 8 | 
|  | 5 | +---   | 
|  | 6 | + | 
|  | 7 | +# EKS Node Viewer: A Hands-On Guide | 
|  | 8 | +#### *Visualize and optimize your EKS node usage with this open-source CLI tool.* | 
|  | 9 | + | 
|  | 10 | + | 
|  | 11 | + | 
|  | 12 | +## Summary | 
|  | 13 | +EKS Node Viewer is an open‑source CLI tool for visualizing scheduled pod resource requests against a node’s allocatable capacity in Amazon EKS clusters, originally built at AWS to showcase workload consolidation with Karpenter. It helps identify under‑ and over‑utilized nodes, driving cost and performance optimization. Installation is straightforward via Homebrew or a Go install, and its rich flag set lets you tailor context, resource types, labels, sorting, and even on‑the‑fly pricing lookups. Key use‑cases include rightsizing clusters, validating consolidation strategies, and enhancing SRE visibility into node utilization. | 
|  | 14 | + | 
|  | 15 | +--- | 
|  | 16 | + | 
|  | 17 | +## Introduction | 
|  | 18 | + | 
|  | 19 | +EKS Node Viewer is a CLI tool for visualizing dynamic node usage within a Kubernetes cluster by comparing scheduled pod resource requests to each node’s allocatable capacity, without measuring actual consumption . | 
|  | 20 | +It was originally developed as an internal AWS tool to demonstrate consolidation capabilities in Karpenter before being open‑sourced . | 
|  | 21 | + | 
|  | 22 | +--- | 
|  | 23 | + | 
|  | 24 | +## Why Use EKS Node Viewer | 
|  | 25 | + | 
|  | 26 | +1. **Immediate Utilization Insights** | 
|  | 27 | +   Quickly spot nodes that are under‑utilized (wasting resources) or over‑utilized (risking performance issues) by viewing request vs. capacity . | 
|  | 28 | + | 
|  | 29 | +2. **Optimize Cost and Performance** | 
|  | 30 | +   By identifying consolidation opportunities, you can safely reduce node counts or reclaim unused capacity, complementing Karpenter’s autoscaling and spot instance workflows. | 
|  | 31 | + | 
|  | 32 | +3. **Enhanced SRE Visibility** | 
|  | 33 | +   Provides a clear, real‑time overview of cluster footprint, aiding incident response and capacity planning. | 
|  | 34 | + | 
|  | 35 | +--- | 
|  | 36 | + | 
|  | 37 | +## What It Is & Key Use Cases | 
|  | 38 | + | 
|  | 39 | +* **Visualization of Scheduled Requests**: Shows CPU, memory (and optionally other resources) requests on each node versus what’s allocatable . | 
|  | 40 | +* **Consolidation Validation**: Confirm that Karpenter’s consolidation logic places pods optimally and safely drains nodes when needed. | 
|  | 41 | +* **Cost Auditing**: With optional pricing lookups, estimate the cost impact of node usage in real‑time (can be disabled if AWS credentials aren’t available) . | 
|  | 42 | + | 
|  | 43 | +--- | 
|  | 44 | + | 
|  | 45 | +## Installation | 
|  | 46 | + | 
|  | 47 | +### Homebrew | 
|  | 48 | + | 
|  | 49 | +```bash | 
|  | 50 | +brew tap aws/tap | 
|  | 51 | +brew install eks-node-viewer | 
|  | 52 | +``` | 
|  | 53 | + | 
|  | 54 | +This installs the latest stable version via the AWS Homebrew tap . | 
|  | 55 | + | 
|  | 56 | +### Manual (Go) | 
|  | 57 | + | 
|  | 58 | +```bash | 
|  | 59 | +go install github.com/awslabs/eks-node-viewer/cmd/eks-node-viewer@latest | 
|  | 60 | +``` | 
|  | 61 | + | 
|  | 62 | +By default this places the binary in your `GOBIN` (e.g., `~/go/bin`) . | 
|  | 63 | + | 
|  | 64 | +--- | 
|  | 65 | + | 
|  | 66 | +## Usage | 
|  | 67 | + | 
|  | 68 | +Run without arguments to inspect all nodes in your current context: | 
|  | 69 | + | 
|  | 70 | +```bash | 
|  | 71 | +eks-node-viewer | 
|  | 72 | +``` | 
|  | 73 | + | 
|  | 74 | +### Key Flags | 
|  | 75 | + | 
|  | 76 | +```bash | 
|  | 77 | +Usage of ./eks-node-viewer: | 
|  | 78 | +  -attribution | 
|  | 79 | +    	Show the Open Source Attribution | 
|  | 80 | +  -context string | 
|  | 81 | +    	Name of the kubernetes context to use | 
|  | 82 | +  -disable-pricing | 
|  | 83 | +    	Disable pricing lookups | 
|  | 84 | +  -extra-labels string | 
|  | 85 | +    	A comma separated set of extra node labels to display | 
|  | 86 | +  -kubeconfig string | 
|  | 87 | +    	Absolute path to the kubeconfig file (default "~/.kube/config") | 
|  | 88 | +  -node-selector string | 
|  | 89 | +    	Node label selector used to filter nodes, if empty all nodes are selected | 
|  | 90 | +  -node-sort string | 
|  | 91 | +    	Sort order for the nodes, either 'creation' or a label name. The sort order can be controlled by appending =asc or =dsc to the value. (default "creation") | 
|  | 92 | +  -resources string | 
|  | 93 | +    	List of comma separated resources to monitor (default "cpu") | 
|  | 94 | +  -style string | 
|  | 95 | +    	Three color to use for styling 'good','ok' and 'bad' values. These are also used in the gradients displayed from bad -> good. (default "#04B575,#FFFF00,#FF0000") | 
|  | 96 | +  -v	Display eks-node-viewer version | 
|  | 97 | +  -version | 
|  | 98 | +    	Display eks-node-viewer version | 
|  | 99 | +```   | 
|  | 100 | +
 | 
|  | 101 | +### Examples | 
|  | 102 | +
 | 
|  | 103 | +```bash | 
|  | 104 | +# Standard usage | 
|  | 105 | +eks-node-viewer | 
|  | 106 | +# Karpenter nodes only | 
|  | 107 | +eks-node-viewer --node-selector karpenter.sh/nodepool | 
|  | 108 | +# Display both CPU and Memory Usage | 
|  | 109 | +eks-node-viewer --resources cpu,memory | 
|  | 110 | +# Display extra labels, i.e. AZ | 
|  | 111 | +eks-node-viewer --extra-labels topology.kubernetes.io/zone | 
|  | 112 | +# Sort by CPU usage in descending order | 
|  | 113 | +eks-node-viewer --node-sort=eks-node-viewer/node-cpu-usage=dsc | 
|  | 114 | +# Specify a particular AWS profile and region | 
|  | 115 | +AWS_PROFILE=myprofile AWS_REGION=us-west-2 | 
|  | 116 | +``` | 
|  | 117 | +
 | 
|  | 118 | +#### Computed Labels | 
|  | 119 | +
 | 
|  | 120 | +Use built‑in computed labels to display node metadata: | 
|  | 121 | +
 | 
|  | 122 | +- `eks-node-viewer/node-age`   | 
|  | 123 | +- `eks-node-viewer/node-cpu-usage`   | 
|  | 124 | +- `eks-node-viewer/node-memory-usage`   | 
|  | 125 | +- `eks-node-viewer/node-pods-usage`   | 
|  | 126 | +- `eks-node-viewer/node-ephemeral-storage-usage` | 
|  | 127 | +
 | 
|  | 128 | +#### Default Options | 
|  | 129 | +
 | 
|  | 130 | +Create a `~/.eks-node-viewer` file to persist your preferred flags: | 
|  | 131 | +
 | 
|  | 132 | +```text | 
|  | 133 | +# select only Karpenter managed nodes | 
|  | 134 | +node-selector=karpenter.sh/nodepool | 
|  | 135 | + | 
|  | 136 | +# display both CPU and memory | 
|  | 137 | +resources=cpu,memory | 
|  | 138 | + | 
|  | 139 | +# show the zone and nodepool name by default | 
|  | 140 | +extra-labels=topology.kubernetes.io/zone,karpenter.sh/nodepool | 
|  | 141 | + | 
|  | 142 | +# sort so that the newest nodes are first | 
|  | 143 | +node-sort=creation=asc | 
|  | 144 | + | 
|  | 145 | +# change default color style | 
|  | 146 | +style=#2E91D2,#ffff00,#D55E00 | 
|  | 147 | +``` | 
|  | 148 | +
 | 
|  | 149 | +--- | 
|  | 150 | +
 | 
|  | 151 | +## Troubleshooting | 
|  | 152 | +
 | 
|  | 153 | +NoCredentialProviders: no valid providers in chain. Deprecated. | 
|  | 154 | +This CLI relies on AWS credentials to access pricing data if you don't use the `--disable-pricing` option. You must have credentials configured via `~/aws/credentials`, `~/.aws/config`, environment variables, or some other credential provider chain. | 
|  | 155 | +
 | 
|  | 156 | +--- | 
|  | 157 | +
 | 
|  | 158 | +## References | 
|  | 159 | +* [GitHub - eks-node-viewer](https://github.com/awslabs/eks-node-viewer)  | 
|  | 160 | +* [Containers from the Couch: Workload Consolidation with Karpenter](https://www.youtube.com/watch?v=BnksdJ3oOEs) | 
|  | 161 | +* [AWS re:Invent 2022 - Kubernetes virtually anywhere, for everyone](https://www.youtube.com/watch?v=OB7IZolZk78) | 
|  | 162 | +
 | 
0 commit comments