kubernetes – kubectl get services with count of actively running pods
A service is basically a load balancer over a deployment (and a deployment is a replica set of multiple pods). So, chances are you want to be listing the deployments instead of the services in this case. Services and deployments are loosely coupled via tags, so there probably isn’t a great way to go from services to pods directly.
I recommend kubectl get deploy -A to view all deployments and their pod counts in all namespaces in this case.
Example output from the kube-system namespace in our cluster (since it’s not sensitive in any way)…
NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE
kube-system cluster-autoscaler-aws-cluster-autoscaler 1/1 1 1 231d
kube-system coredns 2/2 2 2 231d
kube-system ebs-csi-controller 2/2 2 2 231d
kube-system efs-csi-controller 2/2 2 2 231d
kube-system metrics-server 1/1 1 1 231d
Read more here: Source link
