DEV Community

Cover image for Monitoring resources spec attributes with kubectl
Guilherme Sousa
Guilherme Sousa

Posted on

Monitoring resources spec attributes with kubectl

When developing a controller for an operator in Kubernetes, it's always good to check if the attributes of the managed resource are being properly handled.

To do this, you can use kubectl in conjunction with jq to inspect the desired property of the resource.

In the command below, for example, you can obtain the configuration defined for the update strategy of each StatefulSet:

kubectl get statefulsets -o json -w | jq -r '.spec.updateStrategy.type'
Enter fullscreen mode Exit fullscreen mode

Where 'spec.updateStrategy.type' is the json path to the property that will be printed to console.

Top comments (0)