Monitoring resources spec attributes with kubectl
Guilherme Sousa
Posted on January 15, 2024
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'
Where 'spec.updateStrategy.type'
is the json path to the property that will be printed to console.
💖 💪 🙅 🚩
Guilherme Sousa
Posted on January 15, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.