Ugly Command Party Day 5
Shea Stewart
Technologist working in Platform & Customer Engineering Capacities @ RunWhen
On the 5th of the ugly command party, the command I'll share is:
Ugly Command Name: List Images and Tags for Every Container in Running Pods
What does it do?
This command finds all running pods in the namespace and lists every image name and tag used with each container. It can also be easily modified to target failed pods or all pods in the namespace.
When would you use it?
This can be used as a quick way to sanity check your running images, or would be used an audit command, or as part of a CI process to validate that the desired image and tags are indeed Running.
What is the command?
Please view the GitHub Gist below to find the code snippet. Due to a limitation with LinkedIn, it does not accept some code in the code snippet and breaks the Article feature :-/
领英推荐
What is some sample output?
---
pod_name: awx-operator-controller-manager-6b449cbd6-xlrsb
Status: Running
containers:
- container_name: kube-rbac-proxy
image_path: gcr.io/kubebuilder/kube-rbac-proxy
image_tag: v0.14.1
- container_name: awx-manager
image_path: quay.io/ansible/awx-operator
image_tag: 2.3.0
---
---
pod_name: awx-postgres-13-0
Status: Running
containers:
- container_name: postgres
image_path: postgres
image_tag: 13
---
---
pod_name: awx-task-687fbb57f4-mhb2m
Status: Running
containers:
- container_name: redis
image_path: docker.io/redis
image_tag: 7
- container_name: awx-task
image_path: quay.io/ansible/awx
image_tag: 22.4.0
- container_name: awx-ee
image_path: quay.io/ansible/awx-ee
image_tag: latest
- container_name: awx-rsyslog
image_path: quay.io/ansible/awx
image_tag: 22.4.0
---
What does it need?
If you want this command tailored for your environment and ready to copy & paste, this command has been added to the open source library of commands available through RunWhen Local. Check it out here: https://docs.runwhen.com/public/runwhen-local/getting-started/running-locally
Find an example of the command here: https://runwhen-local.sandbox.runwhen.com/awx/awx-Image-check/#list-images-and-tags-for-every-container-in-running-pods
Have an ugly command to share? Collaborate with us on GitHub with issues or discussions
This is part of a series.?Check out?this article?to see additional ugly commands posted in the series.