I have an azuredevops yaml bash task to query all the pods in my aks cluster and from there I used jq filter to query the pods resource statics etc.. as given below.
kubectl get pods -A -o json >all.json
jq -r '["Namespace,NodeName, PodName, ContainerName","MemoryRequest","MemoryLimit","CPURequest","CPULimit"], (.items[] | [.metadata.namespace , .spec.nodeName , .metadata.name ] + (.spec.containers[] | [.name, .resources.requests.memory, .resources.limits.memory, .resources.requests.cpu, .resources.limits.cpu]) ) | @csv' all.json
In addition to the above, I would like to get below details as well
in addition to the Resource request &limit , how I can get and export all pods actual usage of memory and cpu (something like from kubectl top command)
Our release pipelines have version assigned to each releases as part of the pipeline and corresponding version will be appended to the image name of the each kubernetes deployments. So can we dynamically fetch this appended version from the kubernetes deployments( for example, each deployments image will be appended like myregistry/myrepo/myapp1:v1.0.318, from this image name if we are able to get the "v1.0.318" , its the app version). Is this possible to fetch the appversion from all kubernetes deployments and output as above step?
Is it possible to dynamically upload above exported values to Azure wiki in a readable table format and over mail using azuredevops tasks?