JSONPath
A small query language for picking fields out of JSON, which kubectl uses to print exactly one value from an object.
In more detail
Expressions sit in braces and walk the object with dots, such as {.status.phase} or {.items[0].metadata.name}. Two dots, as in {..namespace}, search at any depth. It turns kubectl output into a single value a script can test.
Example
kubectl get pod web -o jsonpath='{.status.phase}'Related terms
- JSON — A simple text format for structured data made of keys, values, lists and nested objects.
- kubectl output format — The -o option and friends that change how kubectl prints objects: wide tables, full YAML or JSON, bare names, chosen columns or JSONPath.
- jq — A command-line tool that reads, filters and reshapes JSON data.
Taught in
- Generators Write The YAML, You Decide — Certified Kubernetes Administrator (CKA) Exam Prep
- Contexts, Namespaces And One-Line Answers — Certified Kubernetes Administrator (CKA) Exam Prep
- Node NotReady: Kubelet, Runtime And Certificates — Certified Kubernetes Administrator (CKA) Exam Prep
- When A Control Plane Pod Breaks — Certified Kubernetes Administrator (CKA) Exam Prep
- A Service With Nobody Behind It — Certified Kubernetes Administrator (CKA) Exam Prep
- kubeadm init And join: What Lands Where — Certified Kubernetes Administrator (CKA) Exam Prep
- Ingress: Hosts, Paths And The Class That Serves Them — Certified Kubernetes Administrator (CKA) Exam Prep
- Placing Pods: Selectors, Affinity, Taints And Requests — Certified Kubernetes Administrator (CKA) Exam Prep
- Rolling Updates And Rollbacks — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Debugging Applications In Kubernetes — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Observability: Timed Drill And Checkpoint — Certified Kubernetes Application Developer (CKAD) Exam Prep
- ConfigMaps And Secrets — Certified Kubernetes Application Developer (CKAD) Exam Prep
- ServiceAccounts And Tokens — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Services And Networking: Timed Drill And Checkpoint — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Mock Exam: Sixteen Tasks Against The Clock — Certified Kubernetes Application Developer (CKAD) Exam Prep
- ServiceAccounts: Take Back The Key — Certified Kubernetes Security Specialist (CKS) Exam Prep
- Control Plane: etcd, API Server, Scheduler, Controllers — Kubernetes: Production-Grade Container Orchestration
- Worker Nodes: kubelet, Runtime, CNI And kube-proxy — Kubernetes: Production-Grade Container Orchestration
- Bootstrap A Local Cluster And Check Your Context — Kubernetes: Production-Grade Container Orchestration
- Troubleshooting: describe, Events And A First Smoke Test — Kubernetes: Production-Grade Container Orchestration
- Troubleshooting: ImagePullBackOff And Failed Rollouts — Kubernetes: Production-Grade Container Orchestration
- ConfigMaps, Secrets And Configuration Updates — Kubernetes: Production-Grade Container Orchestration
- Troubleshooting: OOMKilled, Throttling And Evictions — Kubernetes: Production-Grade Container Orchestration
- Authentication, ServiceAccounts And Short Lived Tokens — Kubernetes: Production-Grade Container Orchestration