Command Palette

Quick search articles, topics, and actions

Snippet.
bash6 lines
H A R S H H A A

Get pod IPs by label across all namespaces with kubectl JSONPath

Custom-columns is fine, but JSONPath gives you raw output you can pipe straight into other tooling.

Source.
bash
kubectl get pods -A -o jsonpath='{range .items[*]}{.metadata.namespace}{"	"}{.metadata.name}{"	"}{.status.podIP}{"
"}{end}' | grep -v NAMESPACE

# Filter to one deployment's pods + their nodeName:
kubectl get pods -l app=my-app -o jsonpath='{range .items[*]}{.metadata.name}{" -> "}{.spec.nodeName}{"
"}{end}'
Zero-friction retrieval.
Pipe it straight into your shell
$ curl -fsSL https://blog.harshhaareddy.com/raw/xx3ant2tzq5lut70fb0787pv | bash

Pipes the raw source straight into your shell. Review the raw output first if you are cautious.