Run the following to get all namespaces exactly:
kubectl get pods --all-namespaces
The first column shows the namespaces and the second column shows pods as follows:
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-flannel kube-flannel-ds-skdpx 0/1 CrashLoopBackOff 20 (3m6s ago) 27m
kube-system coredns-64897985d-kfssj 0/1 Pending 0 10m
kube-system coredns-64897985d-p96wd 0/1 Pending 0 10m
kube-system etcd-ip-172-31-45-235 1/1 Running 0 34m
kube-system kube-apiserver-ip-172-31-45-235 1/1 Running 0 34m
kube-system kube-controller-manager-ip-172-31-45-235 1/1 Running 0 34m
kube-system kube-proxy-vttwh 1/1 Running 0 34m
kube-system kube-scheduler-ip-172-31-45-235 1/1 Running 0 34m
You can also run the following command to get all pods from the namespace if there are too many, for example from kube-flannel:
kubectl get pods --namespace=kube-flannel
Replace kube-flannel with any other namespace you want.
Next to delete pods from kube-flannel or any namespace run the following
kubectl delete pods kube-flannel-ds-skdpx --namespace=kube-flannel
Replace kube-flannel-ds-skdpx with the name of your pod.
Finally if you want to delete the namespace with kubectl:
kubectl delete namespace kube-flannel
This is really annoying from kubectl I really wish there was easier way so let me know if you have one in the comments!