Summary: This post provides the command used to check the Dynatrace Operator version deployed in Kubernetes. It explains where the version information resides and how to query it via kubectl.
Hi All,
Please let me know whether there is any kubectl command to check the Dynatrace operator version installed on the k8s cluster. I know we can check it from DT UI (from kubernetes UI or from Host->Properties UI), but I want it to fetch from the command line to automate the operator upgrade process.
Please guide, thanks.
Guru Gogi
kubectl exec deploy/dynatrace-operator -n dynatrace -- dynatrace-operator troubleshoot
The troubleshoot option reveals the version. There might be a simpler method to obtain it.
@PacoPorro thanks for your reply. I know this command output has operator version, but I was checking whether we can modify this command so that it shows only operator version.
kubectl exec -n dynatrace deployment/dynatrace-operator -- dynatrace-operator support-archive --stdout > operator-support-archive.zip
[support-archive] dynatrace-operator {“version”: “v0.11.0”, “gitCommit”: “…”, “buildDate”: “…”, “goVersion”: “…”, “platform”: “linux/amd64”}
[support-archive] Storing operator version into operator-version.txt
If you are after only the operator version you can try the below
kubectl get deployment dynatrace-operator -n dynatrace -o jsonpath='{.metadata.labels.app\.kubernetes\.io/version}'
@p_devulapalli thanks for reply, its working, its printing % also at the end, need to check how I can remove this % from output.
kubectl get deployment dynatrace-operator -n dynatrace -o jsonpath=‘{.metadata.labels.app\.kubernetes\.io/version}’ 1.0.0%
It should not be adding any % , may be a issue with prompt/formatting. Can you please try the below, it should output to next line clearly
kubectl get deployment dynatrace-operator -n dynatrace -o jsonpath='{.metadata.labels.app\.kubernetes\.io/version}{"\n"}'
@p_devulapalli this has eliminated %, thank you very much.
kubectl get deployment dynatrace-operator -n dynatrace -o jsonpath=‘{.metadata.labels.app\.kubernetes\.io/version}{“\n”}’