File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
content/en/docs/reference/kubectl Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -98,4 +98,16 @@ kubectl get pods -o=jsonpath="{range .items[*]}{.metadata.name}{\"\t\"}{.status.
98
98
```
99
99
{{< /note >}}
100
100
101
+ {{< note >}}
102
+
103
+ JSONPath regular expressions are not supported. If you want to match using regular expressions, you can use a tool such as ` jq ` .
104
+
105
+ ``` shell
106
+ # kubectl does not support regular expressions for JSONpath output
107
+ # The following command does not work
108
+ kubectl get pods -o jsonpath=' {.items[?(@.metadata.name=~/^test$/)].metadata.name}'
101
109
110
+ # The following command achieves the desired result
111
+ kubectl get pods -o json | jq -r ' .items[] | select(.metadata.name | test("test-")).spec.containers[].image'
112
+ ```
113
+ {{< /note >}}
You can’t perform that action at this time.
0 commit comments