vp:
Hello everyone, I hope you are well.
I have a question about “Lab-Mock Exam 1”
Q 3 - Using trivy, what is the correct command to scan the pod images? What did I do:
$ k get po -o custom-colums=name:.metadata.name,image:.spec.containers[].image
and I ran the scan on the images where I got the solution,
is there any Trivy command that does this faster?
Alistair Mackay:
No, but this is where jsonpath comes in! jsonpath is specifically for creating automations.
for i in $(k get po -o jsonpath='{.items[*].spec.containers[*].image}'); do trivy i $i ; done
That should get you started. Sanitize trivy outputs with grep etc. to get only what you need to focus on.
vp:
Thanks Alistair!