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)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay