Skip to content

Commit 0866416

Browse files
committed
JSONPath example
1 parent 82660c8 commit 0866416

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

content/en/docs/reference/kubectl/jsonpath.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ kubectl get pods -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.st
104104
kubectl get pods -o=jsonpath='{.items[0].metadata.labels.kubernetes\.io/hostname}'
105105
```
106106

107+
Or, with a "my_pod" and "my_namespace" (adjust these names to your environment):
108+
109+
```shell
110+
kubectl get pod/my_pod -n my_namespace -o=jsonpath='{@}'
111+
kubectl get pod/my_pod -n my_namespace -o=jsonpath='{.metadata.name}'
112+
kubectl get pod/my_pod -n my_namespace -o=jsonpath='{.status}'
113+
```
114+
107115
{{< note >}}
108116
On Windows, you must _double_ quote any JSONPath template that contains spaces (not single quote as shown above for bash). This in turn means that you must use a single quote or escaped double quote around any literals in the template. For example:
109117

0 commit comments

Comments
 (0)