Last active
September 29, 2024 15:21
-
-
Save besteban1989/f1cdc09a5442948f6430938eff9f5501 to your computer and use it in GitHub Desktop.
Get the current docker images used in pod/deployments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To get the images from deployments | |
kubectl get deploy -n YOUR_NAMESPACE -o jsonpath="{.items[*].spec.template.spec.containers[*].image}" |\ | |
tr -s '[[:space:]]' '\n' | |
# To get the images from pods (it can be duplicates, needs to be removed with commands) | |
kubectl get pods -n YOUR_NAMESPACE -o jsonpath="{.items[*].spec.containers[*].image}" |\ | |
tr -s '[[:space:]]' '\n' |\ | |
sort |\ | |
uniq -c | |
# Get pod names and the node that hosts | |
kubectl get pods -o=custom-columns=NAME:.metadata.name,NODE:.spec.nodeName | |
# Get current replicas and limits for deployments | |
kubectl get deploy -o=custom-columns=NAME:.metadata.name,REPLICAS:.spec.replicas,MEMORYREQUEST:".spec.template.spec.containers[*].resources.requests.memory",MEMORYLIMIT:".spec.template.spec.containers[*].resources.limits.memory",CPUREQUEST:".spec.template.spec.containers[*].resources.requests.cpu",CPULIMITS:".spec.template.spec.containers[*].resources.limits.cpu" | |
# Invoke remote cronjobs | |
az aks command invoke \ | |
--resource-group tsg-ny-ezpass-01-rg-prod-dr \ | |
--name tsg-ny-ezpass-aks-01-prod-dr \ | |
--command "kubectl create job --from=cronjob/tpms-load-all-sorted-cronjob-1 test1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment