I have a kubernetes deployments under the test-namespace as given below
NAME READY UP-TO-DATE AVAILABLE AGE
test-controller 1/1 1 1 38d
services-controller 1/1 1 1 38d
intimidation-controller 1/1 1 1 38d
Origin-controller 2/2 2 2 38d
What command I can use to list only deployments which are having replica count less than 2. So that if I run that command it should return only below output
test-controller
services-controller
intimidation-controller
I used following command for this , but it didn't help and didn't retun anything
kubectl get deployment -n test-namespace -o=jsonpath='{.status.Readyreplicas=1}'
What Command I could use to fetch only the deployment names with less than two replica count
CodePudding user response:
something like this ?
kubectl get deployments.apps -o jsonpath="{range .items[*]}{.metadata.name}{\"\t\"}{.status.replicas}{\"\n\"}{end}" | awk '/1/ {print$1," ",$NF}'