Very basic question here: once I have created a priority-class, how do I query which pods are associated with / are in that priority class?
kubectl describe priorityclass <name>gives details about the priority class itself
And I can get the details of the individual pod via:
kubectl get pod <name> -o yamlBut how do I query all pods that are in a particular priority class?
This will do it:
kubectl get pods -o=jsonpath='{.items[?(@.spec.priorityClassName=="highpriority")].metadata.name}{"\n"}'Change highpriority with whatever label you are using for your priority.
Hope it helps.
This will do it:
kubectl get pods --all-namespaces -o custom-columns=NAME:.metadata.name,PRIORITY:.spec.priorityClassNameYou can change the namespace for specific one by replacing --all-namespaces with --namespace=<your_namespace>.