“Kubectl JQ JSON POD -Name” Code-Antworten

Kubectl JQ JSON POD -Name

# kubectl does not support regular expressions for JSONpath output
# The following command does not work
kubectl get pods -o jsonpath='{.items[?(@.metadata.name=~/^test$/)].metadata.name}'

# The following command achieves the desired result
kubectl get pods -o json | jq -r '.items[] | select(.metadata.name | test("test-")).spec.containers[].image'
DreamCoder

Kubectl JQ JSON POD -Name

# kubectl does not support regular expressions for JSONpath output
# The following command does not work
kubectl get pods -o jsonpath='{.items[?(@.metadata.name=~/^test$/)].metadata.name}'

# The following command achieves the desired result
kubectl get pods -o json | jq -r '.items[] | select(.metadata.name | test("test-")).spec.containers[].image'
DreamCoder

Ähnliche Antworten wie “Kubectl JQ JSON POD -Name”

Fragen ähnlich wie “Kubectl JQ JSON POD -Name”

Weitere verwandte Antworten zu “Kubectl JQ JSON POD -Name” auf Shell/Bash

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen