From the pod lable name=pod, find pods running high CPU workloads and write the name of the pod consuming most to the file. how to solve this?
i do it manually
k top po | grep label. Check the most consuming pod and write in the file. not sure its correct
- kubectl top pods
- parsing the output through the jsonpath or jq creating a kind of csv like: consumption,pod_name
- sort the output through the sort utility
- get last line through the tail -1
kubectl top pods -l name=pod
@Tej_Singh_Rana is it right?
@Venkat kubectl top pod --sort-by cpu name=pod
kubectl top pod --sort-by cpu -l name=pod
@sharan and write manually in the specified file ?