How do you find which Pods use a given ServiceAccount, PVC, or are not Ready?
IntermediateProductionRapid-Fire Commands
Answer
kubectl get pods -A -o json | jq -r '.items[] | select(.spec.serviceAccountName=="ci") | .metadata.namespace+"/"+.metadata.name'
kubectl get pods -A -o json | jq -r '.items[] | select(.spec.volumes[]?.persistentVolumeClaim.claimName=="data") | .metadata.name'
kubectl get pods -A --no-headers | awk '$3!="Running" && $3!="Completed"'
More on Rapid-Fire Commands
How do you list all Pods across namespaces with node and IP?BeginnerHow do you find why a Pod is Pending or not starting?BeginnerHow do you scale a Deployment or StatefulSet imperatively?BeginnerHow do you get a shell into a running container and run a one-off Pod?BeginnerHow do you see all resources and their short names?BeginnerHow do you generate YAML for a resource without creating it?Beginner