'kubectl get service --all-namespace filter out by if Ready matches Available

Looking for query/filter to list only certain deployments: if AVAILABLE column matches READY

Example:

NAMESPACE NAME READY UP-TO-DATE AVAILABLE
app1      app1 1/1    1          1
app2      app2 2/2    2          2
app3      app3 0/0    0          0

Basically just to see anything that is actually running app1 and app2 should be showing from a query.



Solution 1:[1]

This is a generic answer for all kind of resources that prints the READY state in the format of Integer/Integer.

kubectl get deployment --all-namespaces |grep -P '\s+([1-9]+[\d]*)\/\1\s+'

This is only using grep to capture the matching (integer)/(same-integer) format.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1