You can use “kubectl get pods” command for filtering out the pods that are running,evicted, or shutdown.
➜ $ kubectl get pod -n kube-system | grep Running
coredns-78fcd69978-l7p6d 1/1 Running 0 51m
coredns-78fcd69978-v2b2j 1/1 Running 0 51m
etcd-docker-desktop 1/1 Running 4 51m
kube-apiserver-docker-desktop 1/1 Running 4 51m
kube-controller-manager-docker-desktop 1/1 Running 4 51m
kube-proxy-6l445 1/1 Running 0 51m
kube-scheduler-docker-desktop 1/1 Running 4 51m
storage-provisioner 1/1 Running 0 51m
vpnkit-controller 1/1 Running 3 (7m29s ago) 51m
➜ $ kubectl get pod -n kube-system | grep Running | awk '{print $1}'
coredns-78fcd69978-l7p6d
coredns-78fcd69978-v2b2j
etcd-docker-desktop
kube-apiserver-docker-desktop
kube-controller-manager-docker-desktop
kube-proxy-6l445
kube-scheduler-docker-desktop
storage-provisioner
vpnkit-controller
➜ $ kubectl apply -f 1.yaml
pod/demo created
➜ $ kubectl get pod | grep Running | awk '{print $1}'
demo
➜ $ kubectl get pod | grep Running | awk '{print $1}' | xargs kubectl delete pod -n default
pod "demo" deleted
➜ $ kubectl get pod | grep Running | awk '{print $2}'
No resources found in default namespace.