Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

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'
Comment

kubectl jq json pod name jsonpath

kubectl get pods -o json
kubectl get pods -o=jsonpath='{@}'
kubectl get pods -o=jsonpath='{.items[0]}'
kubectl get pods -o=jsonpath='{.items[0].metadata.name}'
kubectl get pods -o=jsonpath="{.items[*]['metadata.name', 'status.capacity']}"
kubectl get pods -o=jsonpath='{range .items[*]}{.metadata.name}{"	"}{.status.startTime}{"
"}{end}'
Comment

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'
Comment

PREVIOUS NEXT
Code Example
Shell :: cmake comment 
Shell :: ubuntu cannot access settings 
Shell :: bash: udevadm: command not found 
Shell :: ubuntu install mariadb 
Shell :: restart nginx windows 
Shell :: remove image docker 
Shell :: wget recursive ftp 
Shell :: bash find text in all csv files 
Shell :: keyboard continuously backspace not working linux 
Shell :: ubuntu add entry to /etc/apt/sources.list 
Shell :: upgrade armbian 
Shell :: brew install older version opencv 
Shell :: docker exec 
Shell :: bash grep 
Shell :: adb kill server kali linux 
Shell :: conda install sentencepiece 
Shell :: qemu specify raw 
Shell :: vim error in ubuntu 
Shell :: awk print only range of lines 
Shell :: use curl to delete an image from docker hub 
Shell :: how to hide log in background job in linux 
Shell :: bash get line from file 
Shell :: ssh disconnecting timeout 
Shell :: git flow feature finish without deleting branch 
Shell :: Check Available SSH Keys on Your Computer 
Shell :: install glade pacman 
Shell :: how to install flow on gatsbyjs 
Shell :: generate angular unit test automatically 
Shell :: awk csv rows to column 
Shell :: ./utserver: error while loading shared libraries: libssl.so.1.0.0: cannot open shared object file: No such file or directory 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =